JPFred
Registered User.
- Local time
- Today, 07:17
- Joined
- Oct 29, 2017
- Messages
- 47
I am writing an app that requires me to validate that a record does not existence in the database. The following is the information:
Database name: main
Record in question: access (primary key (no-dupes))
Form name: Add
Text box name: txtaccess
Event: lost focus
Goal: To check for a existing record in a table.
What I am attempting to do: I need to create a module that can be triggered on a lost focus event that will check the value entered in the text box (txtaccess) against a field (access) in a defined table (main). If a record is not found no action is necessary otherwise display a message box stating "Duplicate record found" and turn control back to the form / txtaccess control while clearing the input data that was entered.
A snippet of what I was thinking of doing is:
I know this is real basic stuff for you old timers but not so for an old batch programmer as myself. The code is very different then RPGLE and I am having some difficulty in making the conversion in thought process.
Once I get a good starting point I can run with it.
Thanks in advance for all of your help,
Doc
Database name: main
Record in question: access (primary key (no-dupes))
Form name: Add
Text box name: txtaccess
Event: lost focus
Goal: To check for a existing record in a table.
What I am attempting to do: I need to create a module that can be triggered on a lost focus event that will check the value entered in the text box (txtaccess) against a field (access) in a defined table (main). If a record is not found no action is necessary otherwise display a message box stating "Duplicate record found" and turn control back to the form / txtaccess control while clearing the input data that was entered.
A snippet of what I was thinking of doing is:
Code:
Dim strfound (What type should this be?)
DLookup( ...) "Could use an example using the information stated above"
if strfound then
MsgBox "Duplicate found"
endif
I know this is real basic stuff for you old timers but not so for an old batch programmer as myself. The code is very different then RPGLE and I am having some difficulty in making the conversion in thought process.
Once I get a good starting point I can run with it.
Thanks in advance for all of your help,

Doc