vba problem with form code

  • Thread starter Thread starter roger
  • Start date Start date
R

roger

Somehow when the user clicks on the finish button it takes
him back to the first page but the old record is still
there instead of all the fields being blank and the
capacity for the new user to enter the new record. I am
pasting the code here.


Private Sub Form_Open(Cancel As Integer)


On Error GoTo Err_Form_Open

DoCmd.Maximize
DoCmd.GoToRecord , , acNext


[FirstName].SetFocus

Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Error$
Resume Exit_Form_Open

End Sub
................

Private Sub cmdFinish_Click()
'check to see that the visitor has put in atleast a value
other than 0 in any of the boxes.
'if not then prompt him to do that definetely.
If (txtAgeUnder18.Value = 0) And (txtAge18to24 = 0) And
(txtAge25to34 = 0) And (txtAge35to44 = 0) And
(txtAge45to54 = 0) And (txtAge55to64 = 0) And
(txtAge65to74 = 0) And (txtAgeOver74 = 0) Then
MsgBox "PLease enter a value other than 0 in atleast one
of the fields"
[txtAgeUnder18].SetFocus
Exit Sub
End If
DoCmd.OpenForm "frmsplash"
'test...GoToPage 1

Dim tbc As Control, pge As Page
' Return reference to tab control.
Set tbc = Me!TabCtl0
' Return reference to currently selected page.
Set pge = tbc.Pages(0)
pge.SetFocus
Form_Activate
End Sub
.............
Private Sub Form_Activate()

On Error GoTo Err_Form_Activate
Dim pge As Page
DoCmd.Maximize
DoCmd.GoToRecord , , acNext
'Me![First Name].SetFocus
'pge.SetFocus
Exit_Form_Activate:
Exit Sub
Err_Form_Activate:
MsgBox Error$
Resume Exit_Form_Activate
............
 
Back
Top