Sql Record Select with multiple fields

ianclegg

Registered User.
Local time
Today, 19:40
Joined
Jul 14, 2001
Messages
58
Hi

Can anyone help?

I am trying to identify selective records using vba and sql and am unable to select the correct records using my code. I have a table containing the records fro selection having the fields JobNo and Code which in all records the criteria for selection.

The code reads

input #1, contract,Porderno,depotname,Pnims

sql="select * from Jobs where jobno = '" & Porderno & "' and code = '" & Pnims & "'"

On running the code my query never finds the records based on the 2 fields, it only appears to work using the first field.

All fields in both the table being queried and the parameters being fed contain the correct data.

Any help would be appreciated.


Regards


Ian Clegg
 
Are both of the filtered parameters alpha? One cannot tell from your posting.

Interger parameters are not enclosed with tic marks.
Date parameters are enclosed with #.
 
Hi

The jobno is numeric eg. 5000005589 and the code is AlphaNumeric eg N573


Regards

Ian
 
As the other poster said. You don't want quotes around numeric fields


sql="select * from Jobs where jobno = " & Porderno & " and code = '" & Pnims & "'"
 

Users who are viewing this thread

Back
Top Bottom