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?
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

mdmilner

Well-known Member
Joined
Apr 30, 2003
Messages
1,352
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,514
Messages
5,596,611
Members
414,080
Latest member
penguin23

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
Top