Howlsta
Vampire Slayer
- Local time
- Today, 21:30
- Joined
- Jul 18, 2001
- Messages
- 180
I've got a form where I can setup new students. Everytime a new student is created the operator has to press a cmdbutton which will append the student to their modules for that year. The problem is the button doesn't work, because the new student is not put in the tblStudent by Access until a navigation button is pressed or the form is closed. How do I get the code to add the student into the table, so that the append query will subsequently have records to add? I figured putting docmd.save before the openquery bit would do the trick but had no joy.
I've placed the current code below.
Any Ideas?
Private Sub cmdReg_Click()
On Error GoTo Err_cmdReg_Click
Dim stDocName As String
Dim rst As ADODB.Recordset
If IsNull(Me.cboYear) Or _
IsNull(Me.CboCourse) Then
MsgBox ("A Year and Course Must be Selected!"), (vbExclamation), _
("Empty Field(s)")
Exit Sub
Else
stDocName = "qAppRegisterStudent"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
Exit_cmdReg_Click:
Exit Sub
Err_cmdReg_Click:
MsgBox Err.Description
Resume Exit_cmdReg_Click
End If
End Sub
I've placed the current code below.
Any Ideas?
Private Sub cmdReg_Click()
On Error GoTo Err_cmdReg_Click
Dim stDocName As String
Dim rst As ADODB.Recordset
If IsNull(Me.cboYear) Or _
IsNull(Me.CboCourse) Then
MsgBox ("A Year and Course Must be Selected!"), (vbExclamation), _
("Empty Field(s)")
Exit Sub
Else
stDocName = "qAppRegisterStudent"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
Exit_cmdReg_Click:
Exit Sub
Err_cmdReg_Click:
MsgBox Err.Description
Resume Exit_cmdReg_Click
End If
End Sub