2nd post:How to create a new record in the subform that match crit

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a main form that has a subform. I want to create a button on this main
form that checks for a certain criteria (eg, if F1 (of main form) is greater
than F2 (of subform)), then create a new record in subform, else pop up a
dialog box.

Any help is much appreciated.
 
Put the following code in the Click event of the button:
If Me!F1 > Me!NameOfSubformControl!F2 Then
Me!NameOfSubformControl.SetFocus
DoCmd.GotoRecord,,acNewRec
Else
DoCmd.OpenForm "NameOfDialogBox"
End If
 
Thank you. That helped.

PC Datasheet said:
Put the following code in the Click event of the button:
If Me!F1 > Me!NameOfSubformControl!F2 Then
Me!NameOfSubformControl.SetFocus
DoCmd.GotoRecord,,acNewRec
Else
DoCmd.OpenForm "NameOfDialogBox"
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com
 
Back
Top