Engine does not recognize " as a valid field

G

Guest

I have unbound form with unbound txtbox(cboDaily), and 2 txtboxes
(txBeginDate) and txEndDate. and command OK

I select an employee from the combox then input the begin and end date,
click ok and its supposed to open a report
however if there is no data for that employee during that date range, I
receive the following error
Microsoft Jet Databases Engine does not recogniz " as a valid field name or
expression

How will I take care of this?
 
R

RuralGuy

How about using the NoData event of the Report to Cancel the report?

I have unbound form with unbound txtbox(cboDaily), and 2 txtboxes
(txBeginDate) and txEndDate. and command OK

I select an employee from the combox then input the begin and end date,
click ok and its supposed to open a report
however if there is no data for that employee during that date range, I
receive the following error
Microsoft Jet Databases Engine does not recogniz " as a valid field name or
expression

How will I take care of this?

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
R

RuralGuy

How about posting the SQL for the report query and maybe we can spot
something.

I actually do have that, but its not calling that function

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
G

Guest

This is the code I have in my command Ok


Private Sub cmdOk_Click()

Dim DocName As String
Dim strWhereEmpl As String

DocName = "Daily Service Level Summary"
strWhereEmpl = "EmpID = " & Forms![ServiceLevelReports]!cmbDaily

If IsNull(Me.cmbDaily) Then
MsgBox "Select an employee to Preview."
Me.cmbDaily.SetFocus
End If

'Check to see that ending date is later than beginning date.
If IsDate(txtBeginDate) And IsDate(txtEndDate) Then
If txtEndDate < txtBeginDate Then
MsgBox "The ending date must be later than the beginning date."
txtEndDate.SetFocus
Exit Sub
End If
Else
MsgBox "Please use a valid date for the beginning date and the
ending date values."
Exit Sub
End If

DoCmd.OpenReport DocName, acViewPreview, , strWhereEmpl



End Sub
 
R

RuralGuy

It looks to me like you could use another Exit Sub:

If IsNull(Me.cmbDaily) Then
MsgBox "Select an employee to Preview."
Me.cmbDaily.SetFocus
Exit Sub '-- <------------------
End If


This is the code I have in my command Ok


Private Sub cmdOk_Click()

Dim DocName As String
Dim strWhereEmpl As String

DocName = "Daily Service Level Summary"
strWhereEmpl = "EmpID = " & Forms![ServiceLevelReports]!cmbDaily

If IsNull(Me.cmbDaily) Then
MsgBox "Select an employee to Preview."
Me.cmbDaily.SetFocus
End If

'Check to see that ending date is later than beginning date.
If IsDate(txtBeginDate) And IsDate(txtEndDate) Then
If txtEndDate < txtBeginDate Then
MsgBox "The ending date must be later than the beginning date."
txtEndDate.SetFocus
Exit Sub
End If
Else
MsgBox "Please use a valid date for the beginning date and the
ending date values."
Exit Sub
End If

DoCmd.OpenReport DocName, acViewPreview, , strWhereEmpl



End Sub

RuralGuy said:
How about posting the SQL for the report query and maybe we can spot
something.



_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top