richy240
Registered User.
- Local time
- Today, 03:37
- Joined
- Oct 23, 2003
- Messages
- 16
I am at a stand still; PLEASE HELP ME!
I have been researching this problem and trying many different things, but I cannot get it to work! Here is what I want to happen:
When I move my cursor from a text box (On Lost Focus), I would like the corresponding table to be checked for the value (a purchase order number). If this PO number already exists in my table, I would like an error to pop up. If it does not already exist, I would like to continue entering data in my form.
This should operate in the background and I would like that this happen as soon as I move away from the text box. This value acts as the Primary Key for the table, and will throw an error if the PO number already exists after I try to move away from the RECORD. But I want it to happen when I enter the PO number (or immediately after - when I move away from the form field) in order to save the time and effort of entering redundant data.
Does this make sense? I have tried using ADO to run a query and check the length of the resulting recordset, but I can't seem to get it to work. (That is, if the recordset contains records, this record must already exist; If the recordset is at EOF then continue entering data.) I am familiar with ADO in ASP, but not VBA.
Does anyone have any recommednations? Please help!
Thanks in advance.
I have been researching this problem and trying many different things, but I cannot get it to work! Here is what I want to happen:
When I move my cursor from a text box (On Lost Focus), I would like the corresponding table to be checked for the value (a purchase order number). If this PO number already exists in my table, I would like an error to pop up. If it does not already exist, I would like to continue entering data in my form.
This should operate in the background and I would like that this happen as soon as I move away from the text box. This value acts as the Primary Key for the table, and will throw an error if the PO number already exists after I try to move away from the RECORD. But I want it to happen when I enter the PO number (or immediately after - when I move away from the form field) in order to save the time and effort of entering redundant data.
Does this make sense? I have tried using ADO to run a query and check the length of the resulting recordset, but I can't seem to get it to work. (That is, if the recordset contains records, this record must already exist; If the recordset is at EOF then continue entering data.) I am familiar with ADO in ASP, but not VBA.
Does anyone have any recommednations? Please help!
Thanks in advance.