Rabu, 05 Oktober 2016

Re: [MS_AccessPros] Combo Box finds first record in table instead of selection



Thanks for these suggestions. I did that and the strComboVar always came back with the correct number so I decided to check the record source of the form and found that I had an inner join between the primary table and delivery table and some records in the primary table didn't have records in the delivery table because the trailers haven't been delivered yet and I was trying to look at a record for a trailer that hasn't been delivered yet.I changed the join to a left join and now it works. Thanks for prodding me along.


---In MS_Access_Professionals@yahoogroups.com, <duanehookom@...> wrote :


Use breakpoints, debug.print, and MsgBox() to troubleshoot your code. It helps to know the value of strComboVar. You have "eyes on the ground" while we can only guess.



From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of winberry.doyce@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Wednesday, October 5, 2016 2:30 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Combo Box finds first record in table instead of selection

Hello Friends,

I have a combo box that is supposed to find the record for the trailer typed into the box. However if you type in the unit number, it displays the first record in the table. Here is the code in the afterupdate event of the combo box:

Private Sub cboLookupTrailer_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As DAO.Recordset
    Dim strComboVar As String

    strComboVar = Me.cboLookupTrailer

    If Len(cboLookupTrailer & vbNullString) <> 0 Then
        Me.Filter = ""
        Me.FilterOn = False
        Me.Recordset.FindFirst "[New Unit #]='" & strComboVar & "'"
    End If
End Sub

I fear corruption. I have tried compact and repair and also deleting the combo box and recreating it. No luck. Anyone have any ideas?



Posted by: winberry.doyce@con-way.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.



Tidak ada komentar:

Posting Komentar