Need General Direction

L

Legacy 3234

Guest
I've got my first fancy database with an entry form set up.

The user makes entries using synchronized combo-boxes and the results are output to a table.

Using queries, I have it set up with the user selecting the text describing the entry (for example: Illinois) but what goes into the output table is the code (12). There are 4 of these synchronized combo-boxes. Other entries are the users's ID and an (automatically generated) entry date.

Here's what I need direction on. I want the user to be able to click a button, which will bring up a message box (or something) asking them to enter their userid and the entry date. That will print a report with all the entries (in text, not code) made by that user on that date.

Can anyone offer any general guidance on how to go about this?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If the userid is a network userid and the entry date happens to be today/whenever they are typing, don't prompt. Just add it directly from code. Put the API call up at the top of a Procedure and call fOSUserName to return a network userid. Date is as direct as using the built in Date() function

Code:
Public Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    
Public Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String

    strUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(strUserName, lngLen)
    If (lngX > 0) Then
        fOSUserName = Left$(strUserName, lngLen - 1)
    Else
        fOSUserName = vbNullString
    End If

End Function

If you're unable to use something similar, for whichever reasons.
You will end up using InputBoxes to accept user input, and then passing the input values into a dynamically generated query that will be used as the Recordsource property for the form.

Alternatively, you could use the input values in the .filter property of the Reports Recordset.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top