Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading Dropdown list data for DAP at runtime

Status
Not open for further replies.

richrock316

Programmer
Jul 30, 2003
57
0
0
US
Hello,

I am experienced at using forms, but this is my first try at using a Data Access Page. I am using Access 2003. What i need to do is populate my dropdown list with dates based on the current date. The info will look like this
"October 19, 2008 - October 25, 2008", etc.
I have a little formula for that, so that is no problem:

reportperiod.disabled = false
firstweek = Month(Date) & "/01/" & Year(Date)
FirstDay = Weekday(firstweek)
If FirstDay < 5 Then
begweek = firstweek - (FirstDay - 1)
firstinc = True
End If
endweek = begweek + 6
......

But i dont know how to put it in the dropdown list on an "onchange" event of a previous list.

Or would it be smarter to have the dropdown linked to a table, and then on the "onchange" event of the previous list i populate that table with the above function (after clearing it first). Problem is i dont know how to do this either.

I have done a decent amount of research on this and the stuff i have tried hasnt worked. Any help or steerings in the right direction would be greatly appreciated.

Richard
 
Your dropdown shows a range? Is this for just titles? I can't see it being for a parameter query.
Remember, DAP's are not forms. They are web pages. So forget what you know about forms.
In you'll see that "many of the Access-specific features (value lists, list-filling callback functions, and so on) won't work here."
More reading:
Modifying the row source of a list box on a data access page in Access

The ListRowSource dictates what's in the listbox and that comes from a table or query. If you use the wizard to create the listbox, an SQL statement is created in the HTML code. You have to modify that by hand.
Are you trying to do a filter? Maybe this would help:
How to Find a Record from a Drop-down List in a Data Access Page

But I'm not sure what you're trying to do.
 
Let me see if i can explain better.

On my DAP I have a dropdown list("SOW")that is populated and working fine. When i select something from "SOW" I want for the onchange event to enable another dropdown ("weeks"). So far it works good for me. The problem is that i want the "weeks" dropdown choices to be created at runtime. I had tried to set it in the onchange of "SOW", but it would also be good for me to be called when the page is loaded (either way would be just as good to me).
The choices for the "weeks" dropdown would be based on the current date and will show the begin and end dates of the weeks for this month. For example: Today is 10/27/08 so it would calculate the weeks and i would want its dropdown choices to show-

09/28/08 - 10/04/08
10/05/08 - 10/11/08
10/12/08 - 10/18/08
10/19/08 - 10/25/08
10/26/08 - 11/01/08

So if i could just find a way to populate my dropdown. Just for clarification purposes, i would want it to be the same as when you can programmatically put data in the "valuelist" of a form.

My program will do a bunch of stuff after that but right now this control has been holding me up.

 
You could build a table with your date ranges. One column could be the start date and then another column your range. so:
Startdate WeekRange
10/05/08 10/05/08 - 10/11/08
Then have a query that filters all dates from current based on the first column. Your criteria could be Date()-6, or whatever, I just guessed.
Then use the query as the source for your listbox. So everytime the page loads, it'll fill the listbox with the ranges you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top