blocking scrolling to another record whn crtn condtns aren't met

T

Ted

on my a2k form, i created a 'add record' cmd button using the following
onclick event code:

Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
Dim response As Integer
Forms("Screening Log").AllowAdditions = True
If Not Me.NewRecord Then DoCmd.GoToRecord , , acNewRec
Me.StudyNumber.Value = "ENTRY REQUIRED"
Me.RegNumber.Value = "ENTRY REQUIRED"
Me.On_Study_Date.Value = #1/1/1900#
DoCmd.GoToControl "StudyNumber"
Forms("Screening Log").AllowAdditions = False
Exit_AddRecord_Click:
Exit Sub

Err_AddRecord_Click:
MsgBox Err.description
Resume Exit_AddRecord_Click

End Sub

perhaps there's something really really obvious about the answer to my
humble question that i'm missing (i still wonder how anybody can learn vba in
3 days [LOL]), but if you grant that i want to compel the user to enter data
into the three control fields it pre-populates with "ENTRY REQUIRED" and
01/01/1900 (per above vba) before letting him succeed in scrolling to another
record, then how does one express that intention in vba?

thoughts?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top