combo not updating form

cjamps

Registered User.
Local time
Today, 08:39
Joined
Feb 2, 2009
Messages
29
First Combo - working appropriately
Private Sub cmbDSerialNumber_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.cmbDSerialNumber) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "dserialnumber = '" & cmbDSerialNumber & "'"
If rs.NoMatch Then
MsgBox "There is no task for: " & cmbDSerialNumber & " Add Task?", vbYesNoCancel
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

'User presses edit task command button
Private Sub EditTaskBttn_Click()
DoCmd.OpenForm "EditTask", , , "[TSerialNumber] = '" & Me.cmbDSerialNumber.Column(0) & "'", acFormEdit
End Sub
' Loading Edit Task Form
Private Sub Form_Load()
Me.TSerialNumber = Forms![Main Switchboard]!cmbDSerialNumber
Me.Caption = "Serial Number: " & Me!TSerialNumber.Value
End Sub
'Query for Second Combo
SELECT TaskList.TSerialNumber, TaskList.[No], TaskList.Task
FROM Dockets INNER JOIN TaskList ON Dockets.DSerialNumber = TaskList.TSerialNumber
WHERE (((TaskList.TSerialNumber)=[Forms]![Main Switchboard]![cmbDSerialNumber]));
'Loading Second Combo
Private Sub CmbTSerialNumber_AfterUpdate()
Me.RecordsetClone.FindFirst "[no] = " & Me!CmbTSerialNumber.Column(2)
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
'I put a breakpoint by
Me.RecordsetClone.FindFirst "[no] = " & Me!CmbTSerialNumber.Column(1)
'then I press F8 to step into the next 2 statements
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
In the immediate window ? no is the correct task number but ? Me!CmbTSerialNumber.Column(1) is alway = to 1. If I add a watch to both those variables they are empty. After the sub is finished ? no is empty and ? Me!CmbTSerialNumber.Column(1) is an error message variable not yet created in this context
A new record is being added with the serial number and the rest of the fields being blank when the record is only supposed to be edited?
Most important the the current record after task no is chosen is not being pulled up.
 
Search Access Help- for the NotInList event. The code is very simple and works very well.
 
the second combo pulls up the correct task no's. I don't have a problem with notinlist. I have a problem with the record that is being chosen is not populating the fields in order to be edited.
 

Users who are viewing this thread

Back
Top Bottom