Forum Moderators: open
I need some help. I have made a login system that when staff scans a barcode it adds the id to the table and allows the staff to login the patron.
The problem arrises when we try scan or type in an id that contains letters. The access field is patronID and it is a text type field.
Here is the code that is used to insert the patronID into the table. This part is for when the patronID is not in the table all ready:
Set conn = Server.CreateObject("ADODB.Connection")'create connection
conn.ConnectionString = "DSN=signup;Database=signup;"'system DSN name; database name
conn.Open'open connection
Const adLockOptimistic = 3
Const adOpenKeyset = 1
Set RS = server.createobject("ADODB.Recordset")'create record set
set RS.ActiveConnection = conn
RS.Open "SELECT * FROM history " _
& "WHERE patronID = '" _
& Request.Form("idnum") & "'" , , adOpenKeyset, adLockOptimistic 'define data for record set, which connection used.
if RS.eof then
' There is no record to match the PatronID
query = "INSERT INTO history (patronID) VALUES (" & idnum & ")"
conn.Execute (query)
conn.close
End IF
If I manually type the alphanumeric patronID into the table then the rest of the screens work fine.
Please help.
Thanks,
Kyle