B
Bob Quintal
1: use an input mask, or create an AfterUpdate event for the storeAgain, I am new to access so thank you all in advance for your
help. Your information and guidance is great.
I have an input form where I have a user input a store#. I then
run a VBA (onUpdate) to validate that the store exists in the
table. I do this by opening a recordset and then do an "if
recordset.eof and recordset.bof then msgbox "does not exist".
Here are my questions:
1. Is there a way to make the user only input numeric values? All
the stores are numeric and the recordset fails if a character is
entered? Or maybe check to see if it is a character and do not
open recordset?
2. Is access quicker (better performance) if I use a dlookup
instead of recordset? If so, how do I then perform a "if else"
depending on whether a record is found. I think I tried this
originally but the dlookup would fail and I could not get passed
it. An example would be great.
Thanks a ton!!!
number that sets a flag based on the isnumeric() function to run the
Dlookup or recordset,
2: there's no noticeable difference. I prefer the DLookup() function
as it's less code to be analysed when upgrading an old applicaion.
and is 'self-documenting' that you are looking up some data.
Example Code
if Isnumeric(Me.[Store#]) then
if isnull(Dlookup("[store#]","Stores", _
"[store#] = & me![store#]) then
msgbox "No Store with this Number"
else
....
end if
end if
3: Have you considered changing your store number textbox to a much
more user-friendly combobox that limits the entry to the list of
store numbers?