How to find if a field exists?

A

Aaron G

Using Access 2003,

I'm trying to create a command button on a form (frmBase) that will open a
popup form (frmPopup) with related data (linked relationship of "ID" and
"ForeignID"). I can get this to work fine, HOWEVER, if there is no data (ie.
the ForeignID does not exist) then I want to open the form in DataEntry =
True mode. I know how to open a form in DataEntry mode, but I'm having
difficulty with the IF/Then.

So, what conditional code do I need to see if a record exists?

TIA

Aaron G
Philadelphia, PA
 
O

Ofer

Can you post what you have now?

On the OnClick event I would put something like that
If Isnull(DLookUp("FieldName","TableName","Enter here the criteria") Then
' New record open in add mode
Docmd.OpenForm "FormName",,,,acFormAdd
Else
' Existing recod, open in edit mode with criteria
Docmd.OpenForm "FormName",,,WhereCondition,acFormEdit
End if
 
A

Aaron G

Ofer,

That worked perfectly. I'm to embarrased to show you the mess I was trying
to make. My blood sugar must be getting low.

As always, thanks for your help.

Aaron G
Philadelphia, PA
 
O

Ofer

Glad I could Help
Good Luck


Aaron G said:
Ofer,

That worked perfectly. I'm to embarrased to show you the mess I was trying
to make. My blood sugar must be getting low.

As always, thanks for your help.

Aaron G
Philadelphia, PA
 

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