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

S

Shalyn

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.
 
P

PC Datasheet

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
 
S

Shalyn

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
[email protected]
www.pcdatasheet.com
 
Top