473,398 Members | 2,427 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,398 software developers and data experts.

Problems with Listbox Rowsource in MS Access 2003

I have created a form in my database that resembles a calendar. I have 42 textboxes that display the day of the week for whatever month and year is selected in the combo boxes at the top of the form. The text boxes are named Text1, Text2, etc. The combo boxes are named cboYear and cboMonth.

Here is the problem: I put a listbox under each textbox that should show the project# for the projects that are active on that day. I'm using 3 fields from my Projects table in the query: Project#, ProjectStart, ProjectFinish. Project# is an autonumber field and is the primary key for the Projects table. ProjectStart and ProjectFinish are date/time fields. Basically, what each listbox should return is the Project# for all projects between the ProjectStart and ProjectFinish date.

I have tried everything that I can think of to make this work. Everytime I run a query it tells me that it is too complex. Here are the details I've tried as rowsource and as a query:

SELECT Projects.[Project#] FROM Projects WHERE (((DateSerial([cboYear],[cboMonth],[Text1])) Between Projects.ProjectStart And Projects.ProjectFinish));

I cannot imagine that this query is too complex for Access to work with. I have been staring at this for three days but have had no luck. Any suggestions you can offer are greatly appreciated. Thanks!
Jul 25 '07 #1
6 4373
Rabbit
12,516 Expert Mod 8TB
To reference a value on a form you need to use Forms!FormName!ControlName
Jul 25 '07 #2
How do I go about doing that?

I don't know how to rephrase the syntax to fit that in.
Jul 25 '07 #3
Rabbit
12,516 Expert Mod 8TB
Well, instead of cboYear you use Forms!FormName!cboYear. The same goes for cboMonth and Text1.
Jul 25 '07 #4
Alright,

I have exhausted all the possible ways to write a rowsource for this listbox. NOTHING is working. Nothing. I have tried to write it by refering to the controls on the form like you suggested and nothing. I tried to write it without using Forms!FormName!Control and still nothing. In fact, all this listbox seems capable of returning is nothing. Here is my current rowsource syntax:

SELECT Projects.[Project#], ProjectStart, ProjectEnd FROM Projects WHERE ((Forms!Calendar!Text3) Between Projects.ProjectStart And Projects.ProjectEnd) ORDER BY Projects.[Project#];

This is where I am now, I cannot think of any other way to do this and it's driving me crazy. Any suggestions are very much appreciated. THANK YOU!
Aug 6 '07 #5
Oh, and Text3 is equal to this:

=DateSerial([cboYear],[cboMonth],[Text6])

And Text6 is equal to this:

=IIf(Text6.Tag=Weekday(DateSerial([cboYear],[cboMonth],1)),1,Text5+1)
Aug 6 '07 #6
Rabbit
12,516 Expert Mod 8TB
Assuming the following:

1) You have 2 combo boxes named cboYear and cboMonth.

2) You have a textbox named txtDay.

3) You have a listbox named lstProjects.

4) They are all on the form Form1.

5) You want the listbox to list all projects that fall on the chosen date.

Then you do the following.

1) The listbox row source is:
SELECT WhatEverColumnsYouWant FROM SomeTable WHERE ProjectStartDate <= CDate(Forms!Form1!cboMonth & "/" & Forms!Form1!txtDay & "/" & Forms!Form1!cboYear) AND ProjectEndDate >= CDate(Forms!Form1!cboMonth & "/" & Forms!Form1!txtDay & "/" & Forms!Form1!cboYear)

2) In the AfterUpdate event of the two comboboxes and text box you requery the list box.
Aug 6 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Colleyville Alan | last post by:
I have an app in which users are displayed a list of mutual fund from which they can choose. There is a listbox embedded in a two-tabbed notebook control. When the form is initally opened, the...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
6
by: Deano | last post by:
I needed to have a listbox populated by locations which are stored in tblLocations. However I wanted an "All locations" entry to be at the top of the listbox. This is not in the tblLocations. The...
3
by: Scott | last post by:
I have a function named MyFunction in a standard module that creates a semi-colon delimited list. I want to use this list for the value list in a listbox. I have the row source type property set to...
4
by: Corey | last post by:
I am having some real trouble getting a listbox rowsource to load properly. The listbox is actually on a subform. My main form has several command buttons that change the MASTER_SUB_FORM object...
6
by: AAJ | last post by:
Hi all I have a listbox on a form. If I set its rowsource directly, and the query in the rowsourse returns no data, then the displayed listbox is empty (exactly as you would expect) ...
6
by: Mark | last post by:
Hello. I have a listbox whose rowsource is set to a saved query (call it "qry_customer_list.") When I add customers to my database, I call the listbox Requery method so that the listbox will...
3
by: ML | last post by:
I have used Allen Brown's technique for filling a listbox on a form with the names of files in a certain disc folder. It works well. I am now giving the user the option to print the form...
6
by: BerkshireGuy | last post by:
On an unbound form, I have a combobox called 'cboproducttype' and a text box called 'txtamountappliedfor'. I have an Add button that I would like the user to be able to hit once a product and...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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,...
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.