473,800 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_AfterUpda te()
Me.List4.RowSou rce = """SELECT QuoteId FROM" & _
" Quote WHERE AccountIdName = " & Me.AccountIdNam e & """ ORDER
BY QuoteId"
Me.List4 = Me.List4.ItemDa ta(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 2345
change this statement (" Quote WHERE AccountIdName = " &
Me.AccountIdNam e & """ ORDER )

- TO -

" Quote WHERE AccountIdName = ' " & Me.AccountIdNam e & " ' " 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_AfterUpda te()
Me.List4.RowSou rce = ""SELECT QuoteId FROM" & _
" Quote WHERE AccountIdName = '" & Me.AccountIdNam e & "'" ORDER
BY QuoteId"
Me.List4 = Me.List4.ItemDa ta(0)
End Sub

Stan

Nov 13 '05 #3

<su*********@ya hoo.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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_AfterUpda te()
Me.List4.RowSou rce = """SELECT QuoteId FROM" & _
" Quote WHERE AccountIdName = " & Me.AccountIdNam e & """ ORDER
BY QuoteId"
Me.List4 = Me.List4.ItemDa ta(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_AfterUpda te()
Me.List4.RowSou rce = "SELECT QuoteId FROM Quote " & _
"WHERE AccountIdName = '" & Me.AccountIdNam e & "' " & _
" ORDER BY QuoteId"
Me.List4 = Me.List4.ItemDa ta(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.AccountIDNa me).

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_AfterUpda te()
Me.List4.RowSou rce = "SELECT QuoteId FROM Quote " & _
"WHERE AccountIdName = """ & Me.AccountIdNam e & """ " & _
" ORDER BY QuoteId"
Me.List4 = Me.List4.ItemDa ta(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*********@ya hoo.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.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_AfterUpda te()
Me.List4.RowSou rce = "SELECT QuoteId FROM Quote " & _
"WHERE AccountIdName = '" & Me.AccountIdNam e & "' " & _
" ORDER BY QuoteId"
Me.List4.Requer y
End Sub

Nov 13 '05 #6

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

Similar topics

3
2536
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 2.3.4 to implement the lock semantics required for specific functions I want to synchronize:
1
2198
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 help would be greatly appreciated.
1
4151
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 box as a filter. In Access 2002 and earlier the row source for the second combo was "SELECT Field1, Field2 etc, FROM MyTable WHERE Field3 =
8
3053
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, disposition and Offense. The second has Offenses and Description of Offenses. I want to display, on a form, all the fields in table one with the Offense field, a drop down, combo box or list box, able to display more than one item. For example, if the...
2
3721
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 by a network appliance. What I'm wondering is what is the best way to keep the ASP.NET (.aspx and .dll) files synchronized across all of the servers in the farm. Our ASP.NET application is very simple - we could just copy the content to all of...
1
1878
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 create a windows application that will allow a user to balance a checkbook. Visually speaking, I want to use multiple list boxes, to display the data: Description, Credit, Debit, Balance, in an effort to emulate the look of a real checkbook ledger. The...
4
1792
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 Access 2007 and previous versions of Access. The following code selects all 38 records in the list box in A2003. For lngLoop = 0 To Me.lstUnreceivedPieces.ListCount - 1 Me.lstUnreceivedPieces.Selected(lngLoop) = True Next lngLoop
1
1915
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 boxes on a form. In the row source I use the primary key of the form as a criteria. For example, I have company details on the form. The list box shows
5
1309
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 that run off that table. I have somewhere around 50 list boxes in each form. Recently all list boxes have lost their format and are now just showing numbers rather than percentages. I check the row source and made sure it was formatted to percent and...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.