Can you help me fix a form button? My On_Click is below. I am trying to run a report based on the information in the displayed record. i.e., with record 3368 displayed, I receive the message: syntax error in date in query expression '(Docket #=3368'.
Note that the report worked when I had the user enter the criteria [Enter Docket #] but I've removed this WHERE clause.
Here is the SQL - is the inner join causing the problem??
Thanks.
SELECT [Project Expenses Table].[Invoice ID], [Project Expenses Table].[Invoice Amount], [Project Expenses Table].[Invoice Date], [Project Expenses Table].[Docket #], [Project Expenses Table].[Docket #], [Project Expenses Table].[Description of Invoice], [Project Request Table].[Project Title], [Project Request Table].Status, [Project Request Table].Expenses, [Project Request Table].[Tracking Estimate], [Project Expenses Table].[Person Submitting Invoice], [Project Request Table].[Date of Request], [Project Request Table].[Budget Amount], [Project Request Table].[Cost Centre], [Project Request Table].[Network Number]
FROM [Project Request Table] INNER JOIN [Project Expenses Table] ON [Project Request Table].[Docket #] = [Project Expenses Table].[Docket #]
ORDER BY [Project Expenses Table].[Docket #];
Here's my On_Click:
Private Sub Command98_Click()
On Error GoTo Err_Command98_Click
Dim stDocName As String
Dim strWhere As String
strWhere = "Docket #=" & Me.txtDocket
stDocName = "rptDocketExpenses"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_Command98_Click:
Exit Sub
Err_Command98_Click:
MsgBox Err.Description
Resume Exit_Command98_Click
End Sub
Note that the report worked when I had the user enter the criteria [Enter Docket #] but I've removed this WHERE clause.
Here is the SQL - is the inner join causing the problem??
Thanks.
SELECT [Project Expenses Table].[Invoice ID], [Project Expenses Table].[Invoice Amount], [Project Expenses Table].[Invoice Date], [Project Expenses Table].[Docket #], [Project Expenses Table].[Docket #], [Project Expenses Table].[Description of Invoice], [Project Request Table].[Project Title], [Project Request Table].Status, [Project Request Table].Expenses, [Project Request Table].[Tracking Estimate], [Project Expenses Table].[Person Submitting Invoice], [Project Request Table].[Date of Request], [Project Request Table].[Budget Amount], [Project Request Table].[Cost Centre], [Project Request Table].[Network Number]
FROM [Project Request Table] INNER JOIN [Project Expenses Table] ON [Project Request Table].[Docket #] = [Project Expenses Table].[Docket #]
ORDER BY [Project Expenses Table].[Docket #];
Here's my On_Click:
Private Sub Command98_Click()
On Error GoTo Err_Command98_Click
Dim stDocName As String
Dim strWhere As String
strWhere = "Docket #=" & Me.txtDocket
stDocName = "rptDocketExpenses"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_Command98_Click:
Exit Sub
Err_Command98_Click:
MsgBox Err.Description
Resume Exit_Command98_Click
End Sub