![]() |
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
If you would use the code tags (the # button in the toolbar) then your post would look like:
Code:
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
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
#3
|
||||
|
||||
|
Are you aware of the fact that this code:
Code:
'User presses edit task command button Private Sub EditTaskBttn_Click() DoCmd.OpenForm "EditTask", , , "[TSerialNumber] = '" & Me.cmbDSerialNumber.Column(0) & "'", acFormEdit End Sub
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
#4
|
||||
|
||||
|
After putting a filter on the "EditTask" form you then proceed to Dirty a record with:
Code:
Private Sub Form_Load() Me.TSerialNumber = Forms![Main Switchboard]!cmbDSerialNumber Me.Caption = "Serial Number: " & Me!TSerialNumber.Value End Sub
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
#5
|
|||
|
|||
|
I have commented out the form load statements. I have taken away the filter so the statement appears as
DoCmd.OpenForm "EditTask", , , , acFormEdit When it gets to the following code: Private Sub CmbTSerialNumber_AfterUpdate() Me.RecordsetClone.FindFirst Me!CmbTSerialNumber.Column(1) = [No] Me.Bookmark = Me.RecordsetClone.Bookmark End Sub I still have the following problem: '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 Me!CmbTSerialNumber.Column(1) is the correct number but ? no is the correct task number is always = 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. |
|
#6
|
||||
|
||||
|
Ant chance you are using the dredded Lookup fields?
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create report with multiple combo box selections form form? | vanlanjl | Reports | 1 | 03-02-2009 08:54 AM |
| Updating Table field from Form | Kunuk | Access | 0 | 02-26-2009 08:41 PM |
| Updating SQL server form Access form? | slash75 | Forms | 1 | 09-06-2008 12:39 PM |
| Filtering subform combo from main form combo | MUKUDU99 | Forms | 0 | 08-17-2008 10:19 AM |
| Updating Multiple Pass-Through Queries through a Form | ryan05 | Access | 0 | 03-19-2006 08:52 PM |