I have a button on a form that displays a report that is based on a query. That query currently has a criteria that prompts the user to enter a date. What I would like to have happen is the user be able to select a date from a list box that is on the for mentioned form. I already have that list box and code behind that list box that places the selected date string in a public variable on that form.
I followed the instructions I found at online and created a function that returns that public variable and then for the criteria for the query entered >FunctionName()
For your reference I tried to post a link to the site where I got the example but could not due to this being my first post.
When I test I get the subject error Undefined Function "GetScanDate" in expression.
I tried adding Public in front of the Function but that made no difference. The error is being generated on the click event of the button. The function is part of the menu form.
Relevant code below.
I am not married to this solution if someone can direct me to a better solution. Thank you in advance for your assistance.
List box containing scan dates.
Button
Query Criteria
Function
I followed the instructions I found at online and created a function that returns that public variable and then for the criteria for the query entered >FunctionName()
For your reference I tried to post a link to the site where I got the example but could not due to this being my first post.
When I test I get the subject error Undefined Function "GetScanDate" in expression.
I tried adding Public in front of the Function but that made no difference. The error is being generated on the click event of the button. The function is part of the menu form.
Relevant code below.
I am not married to this solution if someone can direct me to a better solution. Thank you in advance for your assistance.
List box containing scan dates.
Code:
Private Sub List22_Click()
strScanDate = Me.List22.Column(0)
cmdSelectedScans.Enabled = True
End Sub
Button
Code:
Private Sub cmdSelectedScans_Click()
DoCmd.OpenReport "ScansOnDate", acViewReport
End Sub
Query Criteria
Code:
>GetScanDate()
Function
Code:
Public Function GetScanDate()
GetScanDate = strScanDate
End Function
Last edited by a moderator: