Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update form after Combo Box update

Status
Not open for further replies.

rbertram

MIS
Oct 15, 2002
74
0
0
US
I am trying to update a form after I change the value of a combo box. I have tried the code listed in the FAQs (faq702-3765), but I am getting a 2105 run-time error on one line.

I highligted where the error is occuring.
Code:
Private Sub Office_Number_AfterUpdate()
    
    Dim rs As Recordset
    Dim strOffice As String
    
    Set rs = Me.RecordsetClone
        
    strOffice = "[Office Number]='" & [Office Number].Column(0) & "'"
    rs.FindFirst (strOffice)
        If rs.NoMatch Then
        MsgBox "The selected record cannot be displayed because it is filtered out. " _
        & "To display this record, you must first turn off record filtering.", _
        vbInformation
    Else
        [b][red]Me.Bookmark = rs.Bookmark[/red][/b]
    End If
    Set rs = Nothing
End Sub
 
Have you tried to replace this:
Dim rs As Recordset
By this:
Dim rs As DAO.Recordset

You may have to reference the Microsoft DAO 3.# Object library.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes, I have tried using DAO, but it results in the same error. I have a reference to the DAO 3.51 library.
 
Try changing the rs to object instead of recordset. you may have to change the rs.recordset.clone as well.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top