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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Opens Automatically if Criteria True

Status
Not open for further replies.

MilinPCH

Technical User
Jul 27, 2000
37
US
Hello,

I am creating an inventory database. I have a form (based on a query) that indicates if the current inventory is below the reorder point- I am using an IIF statement in my query. What I am trying to do is write a macro that is attached to the startup switchboard form, so that before it loads it goes and checks my reorder query...if it sees "reorder" in my IIF field it will load the form (so as to warn the user before he does anything else) - if it doesn't find "reorder", it won't load the form and will directly load the switchboard form.

Also, is there a way I can have this code only execute when the database is opened and not every time the user navigates back to the switchboard during nornal database usage?

Thanks!
 
You could create a splash-screen form, which only runs at startup. In this you will need to reference in the field which contains the IIF statement, or moreimportantly the field where the result is stored...Next some code like the following should get you somewhere:

If Forms!frmName!requery.value = "requery" Then
DoCmd.OpenForm "frmName" 'You will need to reference frmName in correctly
ElseIf Forms!frmName!requery.value <> &quot;requery&quot; Then
DoCmd.OpenForm &quot;frmSwitchboard&quot; 'Reference also
End If


Hope this helps James Goodman
j.goodman00@btinternet.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top