Hello,
I have an access table, tbl_Trainer, which holds data for trainers. There are two fields, trainerID and trainerName, which trainerID is the primary key.
I have created a form, named frm_Trainer to enter data to tbl_Trainer, it has the two fields from the table: txt_TrainerID and txt_Name. Entry fields are text boxes.
In the form, I have placed a command button to check if the trainerID that is entered by the user in the text box txt_trainerID already exists in the table tbl_Trainer.
In the command button click procedure I have created a "Result" parameter and built as follows:
result = DLookup ([trainerD], Tables![tbl_Trainer], "[frm_Trainer]![txt_trainerID]=" & Tables![tbl_Trainer]![trainerID])
With this my intention is that if the result is null, Access will display the message that the ID is available, otherwise it will inform the user that the ID is already in the table.
However, the result function is not working and returning an "Object required" message. I could not figure out what is wrong.
I need help with this.
To make the search and return information, I do not insist on using a procedure, if I can do this with a macro, that is fine [and much better, frankly]. If the procedure is the long way to go, can you please direct
me to a source/example which can help me with this issue (find/replace/inform user)?
Thanks,
Tolga