MPH03
Quick question - event procedure. Not.
Okay, event procedures are visible as follows.
- Open form in design mode.
- If you do not see a floating window with the tabs -- Format, Data, Events, Other, All visible, then from the main menu, select "View" and "Properties".
Your world just got bigger.
Their are two "modes" for the properties - form level and field level.
For the form level, view the form (in design mode). In the top left corner, at the junction where the horizontal and vertical measurement bars meet, the "box" should be coloured black. Access 2000 and beyond make it easier. The caption for the properties window at the top will display "Form".
Events include
- On Current
- Before Insert
- After Insert
- Before Update
- After Update
- On Load
- On Open
etc
Hint: order of update events are...
Before Insert -> Before Update -> After Update -> After Insert
Now select a field. The junction box is no longer black. For Access 2000 and beyond, the caption for properties will display the field name.
Events will include...
- Before update
- After update
etc
(will change depending on field type.)
Review Access help for more info. It Access gets real interesting at this point.
BTW, glad you responded to the post, here is a possible solution to your problem.
[blue]
Private Sub Form_Current()
Me.AllowAdditions = True
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
If Len(Nz(Me.YourField)) Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If
End Sub
Private Sub YourField_AfterUpdate()
If Len(Nz(Me.YourField)) Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If
End Sub
[/blue]
Plus add a command button. For button wizard, select form operation and choose refresh. For the title, use "Update". For the name of the button (last step) enter "Update_btn"
Snipets of created will include the following. Add the bolded line.
[blue]
Private Sub Update_btn_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.AllowAdditions = True
End Sub[/blue]
This is not a perfect solution, but should help you a bit. "Play" with a backup copy of your form.