473,789 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with a list box

I need some help figuring something out. I'm not sure if I heading in
the correct direction. What I'm trying to accomplish is the following.
I have a table that
has id, discrip, and 2 date fields. I am populating this information
from a sub from on a
main form. The Id and date fields are tied together in the forms. I am
trying to get the
descrip field to show up in my main form under a listbox. I have
created a sql query to try to accomplish this. I can have multiple
lines of information for each id. That's why I'm trying to show in
list box. The problem I am having is I cannot get it to look for
specific id of the current page I'm on in the form. It prompts me for
id. If I enter the id the list box displays correct info. I would like
for it to see what page I'm on in my form take the id from there and
fill the list box accordingly. When I change sheets it would
automatically update. I have pasted sql query below. I would really
appreciate any insight on how to make this work. Thanks ahead of time.
Dan
SELECT [reserve].[site], [reserve].[reservationid],
[reservations].[reservationsid]
FROM reserve
WHERE (([reserve].[reservationid])=([reservations].[reservationsid]));

Dec 7 '05 #1
15 1751
Dan, I'm not sure I completely understand the situation you have, but I
will try to help with some general listbox information.

To populate a listbox that is bound to a table, you can simply add
records to the table and then call the ListBox.Refresh () method. This
may be useful if your listbox is on the main form but you want to
populate it from a subform. If you are doing many updates of the
listbox, this can have a lot of overhead.

You can also populate the listbox programmaticall y. One way is such:
Here, lstBox will indicate your listbox, and frmMain will indicate your
main form.

Forms!frmMain!l stBox.Items.Add ("info you want to add")

Dec 7 '05 #2
GH
In your query:

SELECT [reserve].[site], [reserve].[reservationid],
[reservations].[reservationsid]
FROM reserve
WHERE (([reserve].[reservationid])=([reservations].[reservationsid]));

Is reservations the form name or is it supposed to be a field from a
joined table. I am not sure if this is your root problem or not, but
your query would give an error right now since the reservations tables
does not exist in the FROM clause. I would expect your query to look
more like:

SELECT [reserve].[site], [reserve].[reservationid],
[reservations].[reservationsid]
FROM reserve, reservations
WHERE (([reserve].[reservationid])=([reservations].[reservationsid]));

OR

SELECT [reserve].[site], [reserve].[reservationid],
[reservations].[reservationsid]
FROM reserve INNER JOIN reservations
ON (([reserve].[reservationid])=([reservations].[reservationsid]));

Also, you really would not need to have two reservationid fields in the
result set, since they are equivalent.

Again, this may not be causing the issue with the list box, but it
might be contributing to it.

Dec 7 '05 #3
Perhaps Im not making myself clear. I want a list box to show
information from a table in a form. The table is not the table that
main form is driving. I want the list box to see the reservationid from
the form on which ever record is active, and to show only the
information where the 2 reservation id's are =. The list box will work
if I type in reservationid, but it won't get it from the active form
page like I want. Hopefully this bettrer explains problem.

Dec 7 '05 #4
so base the listbox's rowsource on a query.

Listbox rowsource:
SELECT [Last] & ", " & [First] AS Contact
FROM olkContacts
WHERE (((olkContacts. City)=[Forms]![Form2]![Combo2]))
ORDER BY [Last] & ", " & [First];

except in your case, your WHERE clause would point to the control on
the form showing the reservationID. So your rowsource would be
something like:

SELECT [Last] & ", " & [First] AS Contact
FROM olkContacts
WHERE (((SomeTable.Re servationID=For ms![MyForm]![txtReservationI D]))
ORDER BY [Last] & ", " & [First];

Dec 8 '05 #5
I have already tried this below. If I am following you you are saying
same thing.
It still won't update the listbox. Is my syntx incorrect?

SELECT [site]
FROM reserve
WHERE [reserve].[reservationid]=('[Forms]![Taking
Reservations]![ReservationsID]');

Dec 8 '05 #6
deercreek <da*@deercreekc g.com> wrote:
: I have already tried this below. If I am following you you are saying
: same thing.
: It still won't update the listbox. Is my syntx incorrect?

: SELECT [site]
: FROM reserve
: WHERE [reserve].[reservationid]=('[Forms]![Taking
^
| what are those for? _________
\
: Reservations]![ReservationsID]'); \
^ \
|______________ _______________ ______\
Dec 8 '05 #7
Are you asking about the reservationsid, Its the text box name that
holds info.

Dec 8 '05 #8
deercreek <da*@deercreekc g.com> wrote:
: Are you asking about the reservationsid, Its the text box name that
: holds info.

Do the quotes that mean that your ID is defined as a string?
I thought number which wouldn't need any quotes.
--thelma
Dec 8 '05 #9
My id is set as a text field currently. I will create my own custom
info to occupie this field once I
get the form to work.

Dec 8 '05 #10

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

Similar topics

6
4355
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
5
2112
by: jhon02148 | last post by:
hi this hw have four files: 1. for the main program 2. listp.cpp (the source file) 3. listp.h (the header file) 4. exception.h if there is anybody who could help me with this hw i really appreciate his help. thanks for anybody in advance
7
1813
by: Christian Christmann | last post by:
Hi, in the past I always appreciated your help and hope that you also can help me this time. I've spent many many hours but still can't solve the problem by myself and you are my last hope. I've a program which is using self-written double-linked lists as a data structure. The template list consists of list elements and the list itself linking the list elements.
5
2202
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table, all has gone very well with one exception. The table is based on applications made by potential customers looking to buy franchise rights to particular locations and as part of the process they are asked to list their preferred locations 1 to 4....
2
2410
by: Foodbank | last post by:
Hi everyone, I'm having trouble implementing a supposedly simple Least Significant Digit first Radix Sort. The book I'm using gave me somewhat of a template that I touched up (below), but I'm very unsure of where to start. I know the basic layout (Initialization of memory space, Distribution of numbers in bins, and then Collection of the bins), but I don't know how to code it. The examples I've seen don't pertain to my situation enough...
2
1598
by: duncanblacksmithmath | last post by:
I know a lot of you have seen this before but I have worked on the program and have gotten it to work thus far but I need help getting these two functions to work and implementing them. Here is what I have been trying to work out for these functions but can't get them to fully work out for me. information: A function to access an element of a list by its index called access i(LL, i). It traverses the list LL and returns the address of...
1
3723
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
83
7879
by: deppy_3 | last post by:
Hi.I am started learning Programm language C before some time.I am trying to make a programm about a very simple "sell shop".This programm hasn't got any compile problem but when i run it i face some other ploblems which i can not correct.I would appreciated if someone take a look at my programm so as to help me.I tried many times to find out where my mistakes are but i didn't manage something. I have made some comments due to the programm...
6
5781
by: sandy | last post by:
I am creating a class (or so I hope) which is to be a JobCollection, linked list of 'Job'. Job is another class already created. JobCollection is just the linked list manager. I have to have this separated into a .h and .cpp file. The code I am attempting to put into the class is code that I have used before, but simply put into the same file/class with the rest of the application. My header looks like this: <code>
0
5576
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
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, 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...
0
10195
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...
0
9979
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
9016
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
6765
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
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2906
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.