Senior System Engineer
New member
- Local time
- Today, 16:06
- Joined
- Sep 2, 2022
- Messages
- 5
Hello,
I have a Form (Page_Scan_Index) with many Labels (ex. Label1, Label2, etc.).
I have a Query (Stamps_on_Page) with 2 fields (Front_Page_Scan_Name and Scott_Number)
I want to CLICK on a Label in the Form and Pass the Label Caption to the Query as a variable.
I created this code:
Private Sub Label1_Click()
Dim pagename As String
pagename = [Forms]![Page_Scan_Index]![Label19].[Caption] + ".jpg"
DoCmd.OpenQuery ("Stamps_on_Page")
End Sub
So, the variable I’m trying to pass to the Query is “pagename”.
pagename is populating perfectly but the query never gets the string.
Within the Query, I am setting the Variable name as the criteria for Front_Page_Scan_Name like this:
[pagename]
I’m assuming I don’t know the correct syntax to pass a variable to the query?
Can someone please help?
Thanks,
Scott
I have a Form (Page_Scan_Index) with many Labels (ex. Label1, Label2, etc.).
I have a Query (Stamps_on_Page) with 2 fields (Front_Page_Scan_Name and Scott_Number)
I want to CLICK on a Label in the Form and Pass the Label Caption to the Query as a variable.
I created this code:
Private Sub Label1_Click()
Dim pagename As String
pagename = [Forms]![Page_Scan_Index]![Label19].[Caption] + ".jpg"
DoCmd.OpenQuery ("Stamps_on_Page")
End Sub
So, the variable I’m trying to pass to the Query is “pagename”.
pagename is populating perfectly but the query never gets the string.
Within the Query, I am setting the Variable name as the criteria for Front_Page_Scan_Name like this:
[pagename]
I’m assuming I don’t know the correct syntax to pass a variable to the query?
Can someone please help?
Thanks,
Scott