not saving record

cjamps

Registered User.
Local time
Today, 08:00
Joined
Feb 2, 2009
Messages
29
When the add task button is pressed the form is supposed to collect the rest of the information for the record. The form opens and the serial number is added to the database however the rest of the field content on the form does not save

Private Sub AddTaskBttn_Click()
Dim Sn As String
Sn = Me.cmbSerialNumber.Column(0)
DoCmd.SetWarnings False
DoCmd.RunSQL "Insert Into Tasklist( SerialNumber ) Select '" & Sn & "' As Expr;"
DoCmd.SetWarnings True
DoCmd.OpenForm "Task", , , "Dockets.SerialNumber =" & "'" & Me.cmbSerialNumber.Column(0) & "'", acFormAdd

End Sub

On the Form Open of Task I have the following code

Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
Sn.Value = Me.OpenArgs
Me.Requery
End If
End Sub

On the task form I have the following save and close button

Private Sub FormClose_Click()
On Error GoTo Err_FormClose_Click
DoCmd.Save
DoCmd.Close
Exit_FormClose_Click:
Exit Sub
Err_FormClose_Click:
MsgBox Err.Description
Resume Exit_FormClose_Click

End Sub
 
DoCmd.Save doesn't save a record, it saves an object, such as a form, after design changes have been made to it!

To save a record you can use

DoCmd.RunCommand acCmdSaveRecord

or

If Me.Dirty Then Me.Dirty = False
 
Okay now I am getting an error that the Microsoft Jet Database Engine can not find the record in the table with the key matching field. How can I pass the serial number from the combo box on form one to form 2?
 
Okay, now I am getting an error "The Microsoft Database Engine can not find a record in the table with key matching fields. How can I pass the content of the serial number field from the combo box on field one to field 2 in order to add a record to the child database?
 

Users who are viewing this thread

Back
Top Bottom