Hi experts:
When I design the input form for customers' data, I divide the address into three parts: City, Borough, and RestAddress, where City and Borough are of the listbox type. I have two tables as follows. I would like to do the following. For example, if I choose "New York City" in the City listbox, then only the corresponding boroughs (Manhattan, Bronx, and Queens) of New York City will show up in the Borough listbox.
In the design view, I would like to try the SQL statement in the "Row Source" of Borough.Borough Name as follows, in which "?" means the content of the CityID field already inputted. So what is "?" ?
SELECT * from Borough WHERE CityID = ?
TABLES:
City:
ID CityName
1 New York City
2 Boston
...
Borough:
ID CityID BoroughName
1 1 Manhattan
2 1 Bronx
3 1 Queens
4 2 Holly Woods
5 2 Santa Monica
6 2 Pasadena
...
3 1362
We discussed very similar question here
Thanks for the reference. Well, there are a lot of discussions and the names of tables, variables, etc., are very confusing. Let me state my problem specifically. I have three tables: City, Area, and Customer:
City:
CityID: Autonumber
CityName: Text
Area:
AreaID: Autonumber
AreaName: Text
CityID: Number (Lookup: from City)
Customer:
CustomerID: AutoNumber
CustomerName: Text
CityID: Number (Lookup: from City)
AreaID: Number (Lookup: from Area)
I have also created a form named “Customer,” and it has basically 4 fields to fill: CustomerID, CustomerName, CityID, and AreaID, in which CityID and AreaID are both combo boxes with control names, "cboCity" and "cboArea", respectively.
I created the following program, but it doesn’t work. The system pops up a window asking me to input the value of variable "Me.cboArea.Lis tIndex." But if I give a correct number it works OK. Can anybody give some suggestion about the program? Thanks in advance.
------------------------------
Private Sub cboCity_AfterUp date()
Me.cboArea.RowS ource = "SELECT DISTINCTROW AreaID, AreaName FROM Area WHERE (CityID = Me.cboCity.List Index)"
Me.cboArea.Requ ery
End Sub
-----------------------------
try changing the WHERE part like this: - Private Sub cboCity_AfterUpdate()
-
Me.cboArea.RowSource = "SELECT DISTINCTROW AreaID, AreaName FROM Area WHERE (CityID = " & Me.cboCity.ListIndex & ")"
-
Me.cboArea.Requery
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: hiroshi ochi |
last post by:
Hello,
Using MSIE 6.0 and above, with javascript is it possible to display an
individual tooltip for each item in a listbox?
I need this functionality to show the listitems that are longer than the
listbox size.
Please refer to this link to get the idea of what I would like to do.
Unfortunately this one is for VB.
|
by: Claire |
last post by:
As a Listbox.item, rather than using a string I'm using a ListItems object,
overriding the ToString method
When I add items to listbox.items, my strings are shown correctly.
On the otherhand, when I update the "value" field the listbox doesn't update
to reflect the new value.
What do I need to do to the following code to correct this please (if it's
possible) ?
public class ListItems
|
by: NBB |
last post by:
I can't figure this one out. Here's the situation, should be pretty
for the pros in here.
I have a ListBox that is populated with the DataTextField and
DataValueField flags of the DataSet. Everything populates just fine
and works great.
The DataTextField displays text from a database column called Path,
which is the absolute URL of a file. What I would like it to display
is just the filename, essentially trimming off everything...
|
by: Ryan Ternier |
last post by:
Thanks for the previous help guys!
I got my list box issue working, but now i'm trying to loop through all the
items in my page.
I want to find each listbox, once I do i strip the ID down to find what I
need so I can populate a DB.
lstTest is dim'd as a ListBox, and I thought I could just do:
|
by: Stimp |
last post by:
I have a listbox of values that I populate from a database.
I want the user to be able to re-order the list
(by first selecting an item and then clicking 'up' or 'down' buttons)
and then save the list back to the database.
First of all, I implemented the re-ordering through client-side
javascript, which worked great (also it didn't require a postback every
time an item was re-ordered). For testing purposes, I'm outputting the
contents...
| |
by: tshad |
last post by:
I have a string that I read from my database: 1|8|5620|541
These are all values in my ListBox. I want to select each of these items (4
of them - but could be many more). At the moment I am doing the following:
Dim a() As String
Dim j As Integer
a = JobCategoriesSelected.Split("|") ' Where
JobCategoriesSelected is set to 1|8|5620|541
For j = 0 To a.GetUpperBound(0)
|
by: Will Chamberlain |
last post by:
I am running into a strange error when I try debugging my current
application. A form loads up with a dynamically-populated textbox full
of software titles. Upon selection of a software title and pressing 'GO'
a checkboxlist is displayed with the users who use the current software.
The checkboxlist is bound to a dataset named "DataTable" and has the
DisplayMember set to "Employee" and the DataValue set to "ID", like the
following:
----...
|
by: bill |
last post by:
I need to be able to dynamically add items to a <asp:listbox> (or HTML
<select runat=server>) using clientside javascript, and retrieve the items
when the page is posted back.
I use this code to add the option to the listbox. It works for <select> or
<asp:listbox> controls.
var opt = document.CreateElement("OPTION");
opt.text = "test";
opt.value="test";
|
by: Academia |
last post by:
(If you've seen this in the drawing NG, sorry. I inadvertently sent it
there.)
I have a listbox populated with Objects.
The Class has a String field that ToString returns.
I assume that is what the ListBox uses for its display. Correct?
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
| |
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,...
|
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...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
| |
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...
| |