ListBox VBA (1 Viewer)

PatAccess

Registered User.
Local time
Today, 03:41
Joined
May 24, 2017
Messages
188
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
Today, 00:41
Joined
Aug 30, 2003
Messages
34,056
As I mentioned before the row source type has to be table/query.
 

PatAccess

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

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:41
Joined
Aug 30, 2003
Messages
34,056
Glad we got it working!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom