help with an Event Procedure

K

Karen

Hi, I'm back to working on this ongoing project and need some help
again.

I have the following code as the Event Procedure for a command button
called SEARCH.

I need to make a change so that when the batchsize isn't within the
range of batchmin and batchmax, no data is displayed. Right now the
user sees the message box, clicks OK and is shown the data (there's a
calculation using batchsize on the form). They are able to print the
form (I don't want them to and I think I can fix that on my own). BUT
what I want is a way to change this so they don't even see the data
and would have to enter a valid batchsize before they do. The query
has to run because I use the batchmin and batchmax fields that are in
the query.

-------------begin code
Me.Requery

'check to see if this reagent is approved
If IsNull(fldrdapproval) Or IsNull(fldqcapproval) Or
IsNull(fldsafapproval) Then

MsgBox "This is an UnApproved Reagent. DO NOT Proceed with the prep of
this reagent.", vbExclamation, "UnApproved Reagent"

End If

'check the batchsize against the min and max, go to code fld if okay
If batchsize >= batchsizemin And batchsize <= batchsizemax Then
[prepprocedure].SetFocus

Else

'display a message if not okay
MsgBox "Please enter a batch size between" & Str(batchsizemin) & "
and " & Str(batchsizemax), vbCritical, "Batch Size out of Range"

'go to batchsize for reentry

[batchsize].SetFocus

End If
------------------end code

Thanks for any help.
Karen S
 

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