HI I have a form with a button that when clicked I want it to create a new record in the first table then open the next form and create a corresponding record in the related table.
I used the following which worked at first but now it doesnt:
Private Sub Command62_Click()
DoCmd.GoToRecord , , acNewRec
Me.BI_Date_Requested.Value = Now()
Me.BI_Status.Value = "Generated"
Refresh
If Me.Dirty = True Then Me.Dirty = False
DoCmd.OpenForm "FrmRoom_Hire_info_BIO_subform2_V2", WhereCondition:="[BI_ID_ptr]=" & Me![BI_ID], Windowmode:=acDialog, OpenArgs:=Me.BI_ID
In the second form I have the following in the ON OPEN command:
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs <> "" Then
Me![BI_ID_ptr].DefaultValue = "" & Me.OpenArgs & ""
End If
End Sub
The line below works if there is already a corresponding record in the second table but I cannot figure out how to create a new record in the second form.
DoCmd.OpenForm "FrmRoom_Hire_info_BIO_subform2_V2", WhereCondition:="[BI_ID_ptr]=" & Me![BI_ID], Windowmode:=acDialog, OpenArgs:=Me.BI_ID
Please could someone help me with this?
I used the following which worked at first but now it doesnt:
Private Sub Command62_Click()
DoCmd.GoToRecord , , acNewRec
Me.BI_Date_Requested.Value = Now()
Me.BI_Status.Value = "Generated"
Refresh
If Me.Dirty = True Then Me.Dirty = False
DoCmd.OpenForm "FrmRoom_Hire_info_BIO_subform2_V2", WhereCondition:="[BI_ID_ptr]=" & Me![BI_ID], Windowmode:=acDialog, OpenArgs:=Me.BI_ID
In the second form I have the following in the ON OPEN command:
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs <> "" Then
Me![BI_ID_ptr].DefaultValue = "" & Me.OpenArgs & ""
End If
End Sub
The line below works if there is already a corresponding record in the second table but I cannot figure out how to create a new record in the second form.
DoCmd.OpenForm "FrmRoom_Hire_info_BIO_subform2_V2", WhereCondition:="[BI_ID_ptr]=" & Me![BI_ID], Windowmode:=acDialog, OpenArgs:=Me.BI_ID
Please could someone help me with this?