Open a new form for the same record.

  • Thread starter Thread starter JimH via AccessMonster.com
  • Start date 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
 
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
 
Back
Top