query by code gives different records

  • Thread starter Thread starter Richard Choate
  • Start date Start date
R

Richard Choate

When I run my code with the SQL below, it gives me fewer records and some
repeated records within the set than if I use that exact same SQL in a
standard select query. I literally copied the SQL you see here and pasted it
in a query and got vastly different results (400 fewer records and some
records were repeated 15 or 20 times). Does anybody have a clue what could
be happening?

mySQL3 = "SELECT tblHistory.EID, EmpBasic.FullName, tblDate, Period, [Gross
Pay], " & _
"FICABase, [401K], Medical, Medicare, DefBen, Travel, " & _
"Overtime, CumWages, CumFICA, CumMedicare, [FICABase]+[Medicare] " & _
"AS Taxes, BonusType FROM EmpBasic INNER JOIN tblHistory ON EmpBasic.EID =
tblHistory.EID;"

Thanks,
Richard Choate, CPA
 
Solved. My error. I have a backup copy of the db that exists in the same
directory as the one referred to in my code. The offending query was feeding
off of the wrong copy of the mdb, therefore giving the wrong answers.

My apologies for bothering the group on this.

Richard Choate
 
Back
Top