sysntax error, only in some versions

  • Thread starter Thread starter chuck s.
  • Start date Start date
C

chuck s.

I get this msg, 'syntax error (missing operator) in query expression 'EID='
from the following code (expression in an 'on click'). The problem is, it
works fine in some environments, but not others.
When I run it on Vista 32 with Office 2007, I get the error - Office 2003, I
don't - same PC (DB is access 2000 version).
Vista 64 with Office 2003, no problem. It does appear to occur only in
2007, but not all the time. Other results (which makes me think it's
something in the code, because this is too random) -

· Client is using Office 2007, XP OS Service Pack 3=Syntax Error
· Same client, different computer, not sure of OS=No Error
· using Office 2007, Vista OS=Syntax Error
· using Office 2007, Vista OS=Syntax Error
· using Office 2007, XP OS Service Pack 2=No Error
also, XP SP3, Office 2007, no error.

Here's the code - Thanks in advance for any help.

Public Sub lstCurrent_Click()

On Error GoTo Err_Handler

If bDups Then
bDups = False
Exit Sub
End If
If Not IsBlank(IIf(Me.fraSearch = 1, Me.lstCurrent.Column(1),
Me.lstCurrent.Column(2))) Then
Me.RecordSource = "select * from tblEmployee where EID=" &
Me.lstCurrent.Column(0)
VisibleControls True

Call SetCertificationStatus
End If

Me.lstCurrent.SetFocus

Exit Sub
Err_Handler:
MsgBox Err.Description
End Sub
 
Thanks for your reply Jim - I am NOT a VB expert, and didn't write this - but
trying to debug it. It involves nothing more than clicking on a name in an
unbound listbox - and it doesn't matter which name. Like I said, I have a PC
with Vista Ultimate 32-bit, running both Office 03 and 07 - same exact DB -
works in the 03 and falls thru to the error msg in 07 - and it doesn't matter
which name I select.
 
I've checked the data in the table - EID is autonum. Here's the query. I
know what you're saying, but somehow it still doesn't make sense that it
works in some environs and not others. Thanks again for looking at this.

SELECT tblEmployee.EID, [tblEmployee].[ELastName] & ', ' &
[tblEmployee].[EFirstName] AS Employee, tblEmployee.ENum
FROM tblEmployee
WHERE (((tblEmployee.InActive)=False))
ORDER BY [tblEmployee].[ELastName] & ', ' & [tblEmployee].[EFirstName];
 
Back
Top