Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Action 1

Status
Not open for further replies.

RobPotts

Technical User
Aug 5, 2002
232
US
Hi,

I've got a form (FrmAddNewMaster) which has a continuous subform (FrmProdCodes). On this subform is a tick box (ToBeUsed). On the Main form I have a button which runs a sereis of queries.

What I would like is that when the button on the main form is pressed it checks all the records on the subform (Based on TblGhost) and ensure at least on of the ToBeUsed check boxes is ticked. If non are ticked I want a message box to come up alerting the user to tick a box, then when the OK button is pressed the rest of the code is not run and the user returns to the form to tick the boxes.

Thanks for your help in advance
Rob! [Bigcheeks]
Process and Procedure are the last hiding place of people without the wit
and wisdom to do their job properly.
 
Just off the top of my head, I would approach this with something like:

intBoxesChecked = DCount("*", "[tblGhost]", "[ToBeUsed] = True")
if Nz(intBoxesChecked,0) = 0 then
msgbox("Hey! Go check a box!")
Exit Function
end if
Do Other Code Here
 
Thank you, that was just what I needed, thanks for the quick response, I can go home now.

Cheers Rob! [Bigcheeks]
Process and Procedure are the last hiding place of people without the wit
and wisdom to do their job properly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top