Open a new form for the same record.

  • Thread starter JimH via AccessMonster.com
  • Start date
J

JimH via AccessMonster.com

Hi All,

My new question is:
I am trying to open a new form from my main form, for the same record I am
editing.

My code is:
DoCmd.OpenForm [PICS], acNormal, "", "[MODELNUMBER]=FORMS![PARTSFORM]!
[MODELNUMBER]"

This code works fine if that [MODELNUMBER] already exists in PICS table.
If I have not entered any data for that Model Number in Pics, the form opens
blank, "No [MODELNUMBER], and I have to manually enter it.

I tried If statement to check for [MODELNUMBER] to see if its Null, and fill
the field, but did not work.

Any ideas to put me in the right direction will be appreciated.

Jim
 
O

Ofer Cohen

Pass the value of MODELNUMBER to the next form using the OpenArgs

DoCmd.OpenForm "PICS", , , "[MODELNUMBER]=FORMS![PARTSFORM]![MODELNUMBER]"
, , , Me.[MODELNUMBER]


On the OnLoad event of the second form write the code

If me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.[MODELNUMBER] = Me.OpenArgs
End If
 

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