Hyperlink opening a report from search criteria

rasher

Registered User.
Local time
Today, 16:34
Joined
Jun 18, 2009
Messages
11
My first post...I couldn't find help on this anywhere.

I have a search form which uses a simple filter to display records and then print a report based off of those records.

The user has requested to be able to click the Employee Name that is displayed (as a hyperlink) to generate a report based off of that employee.

Opening the report is no problem, but storing the Employee value from the form in order to open it has been troublesome.

Here's the code for the tbxName_Click() event:

Private Sub tbxName_Click()

Dim strWhere As String
Dim lngLen As Long

strWhere = "" 'main filter

strWhere = "Trim(tbxName.Value) = Trim([Name])"

' print function
DoCmd.OpenReport "Search Results", acViewPreview, , strWhere

End Sub

It works just fine, but the problem is that no matter which employee name I click, it asks me to input a tbxName.Value, which tells me that it's not storing the value.

Anyone have any ideas?
 
Thanks! I modified my code to :

Private Sub tbxName_Click()

Dim strWhere As String
Dim lngLen As Long

strWhere = "" 'main filter

strWhere = strWhere & "[Name] LIKE ""*" & Me.tbxName & "*"""

' print function
DoCmd.OpenReport "Search Results", acViewPreview, , strWhere

End Sub
 

Users who are viewing this thread

Back
Top Bottom