Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 05-15-2019, 02:55 PM   #16
essaytee
Need a good one-liner.
 
essaytee's Avatar
 
Join Date: Oct 2008
Location: Melbourne, Australia
Posts: 512
Thanks: 9
Thanked 123 Times in 119 Posts
essaytee is on a distinguished road
Re: ListBox VBA

Quote:
Originally Posted by pbaldy View Post
What would you expect Steve? It looks appropriate to me, though looking at it again made me notice the lack of spaces between lines (before FROM and WHERE).
Yep, I picked up on that just after posting. Damn, forgot to read twice, submit once.

__________________
Steve.

I know UNIX, PASCAL, C, FORTRAN, COBOL, and nineteen other high-tech words.
essaytee is offline   Reply With Quote
Old 05-15-2019, 06:01 PM   #17
Galaxiom
Super Moderator
 
Join Date: Jan 2009
Location: NSW Australia
Posts: 11,573
Thanks: 88
Thanked 1,486 Times in 1,402 Posts
Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold
Re: ListBox VBA

Quote:
Originally Posted by essaytee View Post
I don't normally use the end of line _ character to continue string building on the following lines, but I assume that is set up correctly.
No they are incorrect too. They have omitted the space.

Line continuation is <space><underscore>
Galaxiom is offline   Reply With Quote
Old 05-15-2019, 07:00 PM   #18
Cronk
Newly Registered User
 
Join Date: Jul 2013
Posts: 2,131
Thanks: 3
Thanked 463 Times in 456 Posts
Cronk will become famous soon enough Cronk will become famous soon enough
Re: ListBox VBA

And even with spaces between the query clauses, unless there's any records with a ZLS in the query, there will be nothing in the list box, given that Me.Cert =''

Cronk is offline   Reply With Quote
Old 05-15-2019, 07:04 PM   #19
Cronk
Newly Registered User
 
Join Date: Jul 2013
Posts: 2,131
Thanks: 3
Thanked 463 Times in 456 Posts
Cronk will become famous soon enough Cronk will become famous soon enough
Re: ListBox VBA

And if
Quote:
Now it is outputting the actual SQL Language within the listBox
it is likely that the listbox RowSourceType is set to Value List, not Table/query
Cronk is offline   Reply With Quote
Old 05-15-2019, 07:11 PM   #20
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,022
Thanks: 13
Thanked 4,063 Times in 3,998 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: ListBox VBA

Quote:
Originally Posted by Galaxiom View Post
No they are incorrect too. They have omitted the space.

Line continuation is <space><underscore>
There are spaces.
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 05-16-2019, 08:53 AM   #21
PatAccess
Newly Registered User
 
Join Date: May 2017
Posts: 147
Thanks: 103
Thanked 1 Time in 1 Post
PatAccess is on a distinguished road
Re: ListBox VBA

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'
PatAccess is offline   Reply With Quote
Old 05-16-2019, 09:26 AM   #22
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,022
Thanks: 13
Thanked 4,063 Times in 3,998 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: ListBox VBA

As I mentioned before the row source type has to be table/query.

__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 05-16-2019, 10:27 AM   #23
PatAccess
Newly Registered User
 
Join Date: May 2017
Posts: 147
Thanks: 103
Thanked 1 Time in 1 Post
PatAccess is on a distinguished road
Re: ListBox VBA

Thank you very much. It finally works! You guys rock
PatAccess is offline   Reply With Quote
Old 05-16-2019, 10:29 AM   #24
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,022
Thanks: 13
Thanked 4,063 Times in 3,998 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: ListBox VBA

Glad we got it working!

__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
group query listbox - amend each record represented by grouped listbox item(s) NBRJ Forms 3 04-27-2016 02:24 PM
Show only selected values from listbox on form (listbox from a table) STGE Forms 2 09-22-2010 10:37 AM
[SOLVED] Copying data within same form from a listbox containing a query to a blank listbox? AliBali Forms 1 04-22-2006 03:48 PM
get listbox to display records linked to selected record in another listbox guixian88 Forms 1 07-20-2004 04:10 AM
ListBox not updating form selection when changing listbox recordsource Help.Chris Forms 1 02-22-2002 07:52 AM




All times are GMT -8. The time now is 10:15 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World