ListBox VBA (1 Viewer)

PatAccess

Registered User.
Local time
Today, 01:24
Joined
May 24, 2017
Messages
284
Here is the code on the first listBox After_Update Event
Private Sub ListBoxStateLic_AfterUpdate() 'ListBox1
Dim strtask As String
strtask = "SELECT Cert FROM Qry_PEStateLicCert WHERE LicNum= '" & Me.ListBoxStateLic.Column(1) & "'"
Debug.Print strtask
Me.ListCert.RowSource = strtask 'ListBox2
Me.ListCert.Requery
Me.ListCert = Me.ListCert.ItemData(1)

End Sub

I checked and the immediate window give me the correct Result
SELECT Cert FROM Qry_PEStateLicCert WHERE LicNum= '48435'

The listBox Row Source Type is set to Value List BUT when I am I go to run the program, the listBox 2 shows the SQL language instead of the value itsetlf
So it shows this: SELECT Cert FROM Qry_PEStateLicCert WHERE LicNum= '17265'
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:24
Joined
Aug 30, 2003
Messages
36,124
As I mentioned before the row source type has to be table/query.
 

PatAccess

Registered User.
Local time
Today, 01:24
Joined
May 24, 2017
Messages
284
Thank you very much. It finally works! You guys rock :)
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:24
Joined
Aug 30, 2003
Messages
36,124
Glad we got it working!
 

Users who are viewing this thread

Top Bottom