"If" question

M

margaret

I have a form ... frmExhibitor and from that form I can open frmAccounting
displaying only the data the pertains to the exhibitor selected in
frmExhibitor. However, I would like to have an if that states if there is
data for frmAccounting open to that data, if not then open a new form. How
would I do this?
 
A

Al Campagna

margaret,
The OpenForm method has a "Where" argument.
frmExhibitor should have a key unique identifier, the value of which,
pertains to just that record and no others. Example would be CustID.
So, when opening frmAccounting use the Where argument...
DoCmd.OpenForm "frmAccounting", , , "CustID = Forms!frmExhibitor!CustID"

If there is a record in frmAccounting's table, that has a CustID = to
frmExhibitor CustID, frmAccounting will open on that record.
If not, a New blank frmAccounting record will be displayed...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
M

margaret

Thank you ... I actually went to the macro I had set up for the forms and
used the Where argument there. Thanks for pointing me in the right direction.
 
Top