Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile Error

Status
Not open for further replies.

Ragah21

MIS
Apr 17, 2007
17
US
I have Compile Error on "open"
Private Sub Command16_Click()
Dim qdfCurr As DAO.QueryDef
Dim strPrompt As String
Dim strSQL As String
Dim Crei As String
'Input the random number of Year you want access
'by changeing the Step1_Member_Status query
strPrompt = InputBox("Enter Year in YYYY format.", "Required Data")

If Len(strPrompt) > 0 Then
If IsNumeric(strPrompt) Then
strSQL = "select * from Requests " & _
"where Year([Submit_Date])=" & strPrompt & " AND [Assigned Team Member] in ("Open", "Closed")"


Set qdfCurr = CurrentDb().QueryDefs("Step1_Member_Status")
qdfCurr.SQL = strSQL
End If
End If

If Check_Records Then
DoCmd.OpenReport "Step1_Status_Summary", acViewPreview
Else
MsgBox "There are no records to view", vbOK, "Error"
End If
End Sub
 
This line:

[tt] "where Year([Submit_Date])=" & strPrompt & " AND [Assigned Team Member] in ('Open', 'Closed')"[/tt]

Quotes emclosed in quotes must be either single (') or doubled ("").

It is always nice to be told where the error is occurring.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top