I have a form where the user enters a preassigned number. I want VBA to automatically assign a value to the primary key field that consists of the number entered by the user + 20 at the end. Example: user enters 12345 in txtNum field, VBA assigns 1234520 in txtNumID field. I have written the following pseudocode to demonstrate what I would like to see. This is attached to the txtNum data entry field on the form(?).
After update txtNum
Check to see if txtNum exists
If no
txtNumID = txtNum + 20
If yes
AlertBox = "Number already exists
search number field for
existing record"
Set Focus.txtNum
DoCmd.GoToRecord , , acNewRec
End if
Any help is appreciated! I'm new to Access VBA and so far this site has been a tremendous help! Thanks in advance.
After update txtNum
Check to see if txtNum exists
If no
txtNumID = txtNum + 20
If yes
AlertBox = "Number already exists
search number field for
existing record"
Set Focus.txtNum
DoCmd.GoToRecord , , acNewRec
End if
Any help is appreciated! I'm new to Access VBA and so far this site has been a tremendous help! Thanks in advance.