Requery a list or combo box

captnk

Registered User.
Local time
Today, 00:30
Joined
Dec 12, 2001
Messages
148
I have been looking thru the files here for help on doing a requery.

From stuff i have found i get the general idea,but in practice i cant make it work.

The listbox has the following fields [Date] [location]
I can find on the date fine,but I am missing something in trying to get an "afterupdate" requery.

Could someone help me out with some advice on the steps and where each bit goes please.
 
Not sure I understand this message nor the one you sent in reply to PaulJK.

You have a Combo box (combo46) which displays the Date and Location and its rowsource is Query1. After double-clicking the date, you want to combo box to display just the Locations for the selected date.

Is this correct?

shay
 
Why do you want to do a requery after update?
On principle it would be done like that:
From the AfterUpdate property of the combo, choose: 'EventProcedure', click on ... and write:

Me.Controls("YourComboName").Requery

But you should tell us a bit more about the context.


Edit: Of course, if you are running various threads on the same topic at the same time, do not expect people to be able to provide you with adequate help
 
Last edited:
Tks Shay and Alexandre.
I am not intentionally running 2 threads..the only reason i reposted this was the other was disapperaing without a response and i felt i wasnt clear enough.

Shay !
Date = can be any day of the week,and their can be multiple locations on any given day..(sporting events)
Thats why I need to be able to select not just on the date but also a particular venue.
The file lists these events by date and location in seperate fields +(the stats that go with it.). Its the latter data that im trying to pull .



so all i need somehow is to be able to pass both fields into a query, but so far all i have found is that query's with dual criteria from a list/combo box (manually entered) dont run....Access reports the calculation is to complex,and anyway like I said I cant figure out how to pass the second column to the query anyway.


Alexandre.
No I dont really want to do a requery but i just cant work out how after querying on [date],how i can then get it to look up that location
Somehow I need to get it to select the location column.
I tried the suggestions by Pat and others )Thats where i came up with the requery idea,but i couldnt get it to work.
The problem I am having is how to pass the [location] column criteria into the query
And thats wher I am stuck......
Thanks for yr efforts so far
 
Let's see if I state your problem correctly: you want a combo to display two fields: a date and a location related to that date, so that if the user chooses one date, he can always see the related location?
 
Thanks Alexandre.
Sorry That my posts aren,t really clear Ihave been burning midnight oil on this since Friday and I am starting to confuse myself as well.
So here is the problem better explained I hope

I have a form called "Ysplash", i n which resides the list box (list46)
Listbox displays [date] [location] fields.

I have a Table called "datemeetlist",which has 2 columns [date] and [location]
This Table is the Rowsource for the Listbox

eg.
[Date] [Location]
23/1/2002 Syd
23/1/2002 Melb
23/1/2002 adel
19/1/2002 Syd
18/1/2002 Adel
18/1/2002 Melb
etc
A total of some 36000 entries
This is effectively a menu of events

I then have a statistic table "base"
this table has fields like
[date] [location] [wins] [losses] [data1] [etc]

The data for each date and location and each statistics item is in a DISTINCT ROW in Table "Base"

I then have a query(#2)
That queries [date] [location] [wins] [losses] [data1] [etc], from table "Base"

In this query Fields [date] has the following criteria
[forms]![ysplash]![list46]

In the listbox properties the bound column is Column 1 [Date]

On clicking on a date in the list box currently the query finds that date BUT also every location plus the statistics on that date.

(Just for the record if I manually enter the date and location in the query it works,so I know that is fine)

Somehow I need to be able to pass Column 2 [location] from List46 to the query as well .

And thats my current dilemna.
Hope that is clearer.

Many thanks yr patience on this.
 
Well I finally understand the problem :)

Add a new unbound control to the form. It can be hidden if you like. In the AfterUpdate event of the Combo, store the value of the second column in this control.

Me.NewControl = Me.YourCombo.Column(1)
Me.Combo2.Requery

Then in the where clause of the second combo's query:

Where MyDate = Forms!YourForm!YourCombo1 AND MyLocation = Forms!YourForm!NewControl;
 
Pat! Many thanks for yr response on that.
I have saved the suggestion for future reference,which I,m sure will arise again.

HOWEVER
In my deperation I found another way to solve the problem.
It may not be "Politically Correct" programming but it works.

I added a new column to my "Datemeetlist" Table" and included it in the data import query for this table as follows.

code:[Date]&[location]
This created a code to align with each item in the list.
(Since each is a distinct row thats not a problem)
So the third column was added to the Listbox,and I set the bound column in the list box properties to that "code "column.
I just hide that column by narrowing the listbox.

Whatever it works!!!!!! and finally I can move on.:)
My thanks to all who contributed to the post.
Captnk
 

Users who are viewing this thread

Back
Top Bottom