Hi,
Im trying to have a search page in my form where users can select one field or both for a search criteria which will open another page to display results. My first field"Payment subject" works fine on its own, but my date field is not working, is anyone able to help me with this small problem??
If IsDate(txtDueDate) Then
strSql = "SELECT Payment.* FROM Payment" _
& " WHERE Format([Due Date],'dd-mmm-yyyy')= #" _
& Format(txtDueDate, "dd-mmm-yyyy") & "# "
Else
'''''dateSearch = False ' if this is a boolean function it will be false by default
txtDuetDate.SetFocus
MsgBox "You must enter a valid date first"
Exit Sub
End If
The error i get it run time error saying sql expression is incorrect and it goes to debug this error:
If dateSearch = True And subjectSearch = False Then
=> DoCmd.OpenForm "Select Payment", acNormal, , strSql
End If
Im trying to have a search page in my form where users can select one field or both for a search criteria which will open another page to display results. My first field"Payment subject" works fine on its own, but my date field is not working, is anyone able to help me with this small problem??
If IsDate(txtDueDate) Then
strSql = "SELECT Payment.* FROM Payment" _
& " WHERE Format([Due Date],'dd-mmm-yyyy')= #" _
& Format(txtDueDate, "dd-mmm-yyyy") & "# "
Else
'''''dateSearch = False ' if this is a boolean function it will be false by default
txtDuetDate.SetFocus
MsgBox "You must enter a valid date first"
Exit Sub
End If
The error i get it run time error saying sql expression is incorrect and it goes to debug this error:
If dateSearch = True And subjectSearch = False Then
=> DoCmd.OpenForm "Select Payment", acNormal, , strSql
End If