Validation and Message Box

N

nutmeg

Hello, I have a main form for install entry has a button to open an inventory
form. Each install as a general rule must have an entry to inventory. I
would like to put a message box on the install form somewhere to ask the
enterer 'have you entered the inventory yet?' Where should this be placed.
Second, there is a field on the install form that would define the type of
inventory i.e. inside or outside. The inventory is different for each one so
I would like to build a validation that says when they go to inventory 'the
item you picked doesn't match 'inside'. Can someone advise where and how to
do both of these items.

Thank you,
IEJ
 
M

Michel Walsh

HI,


For the first part, you can use a combo box and "Limit to list" the data
that can be inputted. Alternatively, you can use a DLookup or a DCount, in
the After Update event of the CONTROL (not the Form) to know if the criteria
is satisfied, or not:


if 0 = DCount("*", "tableNameHere", "field1 = this AND field2 =
that" ) Then

MsgBox "Not good!"
...

end If


The criteria, here the third argument of DCount, does not have to be
"fixed", it can be a string you built, at run time, accordingly to the input
already known:


Dim str As String
...
if ... then str = " ItemID=" & Me.ItemID & " AND inOut=" & Me.InOut
...
if 0 = DCount("*", "myTableNameHere" , str ) then

...

end if




Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top