T
TC
Erm, it fires the instant the user types a keystroke into a blank new
record, no?
TC
record, no?
TC
Cheryl Fischer said:Junior,
Try putting your code in the Before Insert event of your form. Before
Insert is the event that fires before a record is inserted into a table.
hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX
Junior said:I want to limit the number of records a user can enter into a lookup table
via a form. The table currently has 5 records; however, a max of 7 records
is permissable. how can i code to not allow more than 7 records. i.e. allow
changing current records but not allowing more than 7 total.
see below code i entered in the before updte event for the primary key
field. but this doesnt delete the entry??
hlp plse.
Private Sub Loc_ID_BeforeUpdate(Cancel As Integer)
Dim intCnt As Integer
intCnt = DCount("[LocID]", "[tlkpLocation]")
If intCnt = 7 Then
MsgBox " You may not enter more than 7 locations "
Cancel = True
Exit Sub
End If
End Sub