combo not updating form

cjamps

Registered User.
Local time
Today, 08:02
Joined
Feb 2, 2009
Messages
29
I have 2 tables. Dockets and Tasks. Dockets contains the serialnumber (DSerialNumber) and the attorney docket number (DocketNumber). Tasks contains the serial number (TSerialNumber) which is related to the serial number in dockets, the task no (no) because there could be several tasks, the task, the due date for each task as well as other fields.
I am trying to program it that if the user chooses to edit the task a record is chosen from a combo, the user presses edit task command button, a form should open populating the fields with the chosen record.
On the first form I have a combo with all the serial numbers. The user chooses the appropriate serial number and when the user presses the edittask button a form opens up with the combo that contains the tasks for that serial number.
First Combo - working appropriately
Private Sub cmbDSerialNumber_AfterUpdate()
Me.RecordsetClone.FindFirst "[DSerialNumber] = '" & Me![cmbDSerialNumber] & " '"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Private Sub EditTaskBttn_Click()
DoCmd.OpenForm "EditTask", acNormal, , , acFormEdit, acDialog
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
Second Combo
Private Sub CmbTSerialNumber_AfterUpdate()
Dim rs As DAO.Recordset
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "'[no]' = " & Me.CmbTSerialNumber.Column(1)
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub
I have the following 3 questions.
1. Why is the user being pointed to the first field in the detail when the task combo is in the header?
2. me.cmbTSerialNumber.Column(1) is supposed to be = to the task no. Going through the debug cmbTSerialNumber is working appropriately but it is not putting the value into no. from the combo
3. 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.
 
How about using CODE TAGS here so it is easier to read:

Code:
' First Combo - working appropriately
Private Sub cmbDSerialNumber_AfterUpdate()
   Me.RecordsetClone.FindFirst "[DSerialNumber] = '" & Me![cmbDSerialNumber] & " '"
   Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Private Sub EditTaskBttn_Click()
   DoCmd.OpenForm "EditTask", acNormal, , , acFormEdit, acDialog
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

' Second Combo
Private Sub CmbTSerialNumber_AfterUpdate()
   Dim rs As DAO.Recordset
      'Search in the clone set.
      Set rs = Me.RecordsetClone
      rs.FindFirst "'[no]' = " & Me.CmbTSerialNumber.Column(1)
         If rs.NoMatch Then
            MsgBox "Not found: filtered?"
         Else
            'Display the found record in the form.
            Me.Bookmark = rs.Bookmark
         End If
   Set rs = Nothing
End Sub

And this is how you use the code tags on this forum (not in your code):

codetag001.png
 

Users who are viewing this thread

Back
Top Bottom