473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Synchronizing Two List Boxes problem - Access 2003

Hi everyone,

I have a problem synchronizing two list boxes on a form. I want to
display information in the second box based on the selection in the
first box. First box (List0)lists all company names from table that
lists quotes. I diplay a company only once even if it is listed more
that one time. The second box (List4)should display quotes for a
selected company (one or more.) Here is what I have for AfterUpdate in
the first box:

Private Sub List0_AfterUpdate()
Me.List4.RowSource = """SELECT QuoteId FROM" & _
" Quote WHERE AccountIdName = " & Me.AccountIdName & """ ORDER
BY QuoteId"
Me.List4 = Me.List4.ItemData(0)
End Sub

I use double quets here because I read here on google that if my field
is not numeric or bulean I need to put qotes around it. Without qotes I
get the same error message as with. When I run it I get the following:

Syntax Error (Missing Operator) in Query Expression 'AccountIdName =
Advanced.....' (the name of one of our clients in listed.) Any idea
what is missing?

Thanks,

Stan

Nov 13 '05 #1
5 2323
change this statement (" Quote WHERE AccountIdName = " &
Me.AccountIdName & """ ORDER )

- TO -

" Quote WHERE AccountIdName = ' " & Me.AccountIdName & " ' " ORDER

NOTE: where I put the single quotes

Nov 13 '05 #2
What about the double quotes in the begfining? Please, include the
whole block in your answer. Id dousn't work again:

Private Sub List0_AfterUpdate()
Me.List4.RowSource = ""SELECT QuoteId FROM" & _
" Quote WHERE AccountIdName = '" & Me.AccountIdName & "'" ORDER
BY QuoteId"
Me.List4 = Me.List4.ItemData(0)
End Sub

Stan

Nov 13 '05 #3

<su*********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi everyone,

I have a problem synchronizing two list boxes on a form. I want to
display information in the second box based on the selection in the
first box. First box (List0)lists all company names from table that
lists quotes. I diplay a company only once even if it is listed more
that one time. The second box (List4)should display quotes for a
selected company (one or more.) Here is what I have for AfterUpdate in
the first box:

Private Sub List0_AfterUpdate()
Me.List4.RowSource = """SELECT QuoteId FROM" & _
" Quote WHERE AccountIdName = " & Me.AccountIdName & """ ORDER
BY QuoteId"
Me.List4 = Me.List4.ItemData(0)
End Sub

I use double quets here because I read here on google that if my field
is not numeric or bulean I need to put qotes around it. Without qotes I
get the same error message as with. When I run it I get the following:

Syntax Error (Missing Operator) in Query Expression 'AccountIdName =
Advanced.....' (the name of one of our clients in listed.) Any idea
what is missing?

Thanks,

Stan


Stan, you're pretty darned close.

Private Sub List0_AfterUpdate()
Me.List4.RowSource = "SELECT QuoteId FROM Quote " & _
"WHERE AccountIdName = '" & Me.AccountIdName & "' " & _
" ORDER BY QuoteId"
Me.List4 = Me.List4.ItemData(0)
End Sub
Here I've used single quotes (I'll show the double quotes below). Note that
the quotes are only around your WHERE clause argument (Me.AccountIDName).

If you prefer to use double quotes, they need to be doubled, so that the
compiler understands that you mean for them to be "literal" quotes, not
simply to contain a string value.

Private Sub List0_AfterUpdate()
Me.List4.RowSource = "SELECT QuoteId FROM Quote " & _
"WHERE AccountIdName = """ & Me.AccountIdName & """ " & _
" ORDER BY QuoteId"
Me.List4 = Me.List4.ItemData(0)
End Sub

Hope this helps,
Randy

Nov 13 '05 #4
Hi Randy,
I used your suggestion and I have my second box populated but it only
show very first quote regardless the selection in the first box.

Stan

Nov 13 '05 #5

<su*********@yahoo.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Hi Randy,
I used your suggestion and I have my second box populated but it only
show very first quote regardless the selection in the first box.

Stan


You probably need to requery the ListBox

Private Sub List0_AfterUpdate()
Me.List4.RowSource = "SELECT QuoteId FROM Quote " & _
"WHERE AccountIdName = '" & Me.AccountIdName & "' " & _
" ORDER BY QuoteId"
Me.List4.Requery
End Sub

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Keith Veleba | last post by:
Hello to all fellow c.l.p'ers! Long-time listener, first-time caller. Background: I'm working on a project where I have to do some serious multithreading. I've worked up a decorator in Python...
1
by: chongo | last post by:
Hi Does anyone know how to synchronize 2 combo boxes? Say I have 2 combo boxes, A and B If I scroll up or down in List A, I want List B to scroll up and down in synch with List A? Any...
1
by: Jeff Smith | last post by:
Hi This is a repost due to no responses Here's a problem I've encountered with Access 2003 which has got me to redesign how I get the row source in a second combo box using the first combo...
8
by: vpettes | last post by:
I am new to Access having used Filemaker for many years. My question has to do with displaying and creating a line item database. What I have is a two tables. One has Name, Location, time,...
2
by: Christopher D. Wiederspan | last post by:
We are getting ready to move an ASP.NET application off of a single development machine and onto a "webfarm". Basically our webfarm is a bunch of identical servers with the load-balancing provided...
1
by: Rkwarner2 | last post by:
Hello everyone. This is my very first post in this forum. I'm taking my first Visual Basic.Net Class and am wanting to try some new things for one of my homework assignments. The assignment is to...
4
by: Tony Toews [MVP] | last post by:
A client asked why some code behind a list box suddenly started updating 57386 records in a table instead of the expected 38 records. Turns out the problem is a difference in behavior between...
1
by: DrJarmin | last post by:
Hello The problem is this: in the criteria for a list box I reference the parent form - and Access KEEPS changing the criteria for one that won't work. Details below: I have a couple of list...
5
by: freddie1437 | last post by:
I have a big problem and would appreciate any help! I have an Access 2003 Database and I have forms in the database that have many list boxes. I only have one table that is a link and many queries...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.