SQL 7 Database Access- filling multiple datalist boxes- Newbie question. 
Author Message
 SQL 7 Database Access- filling multiple datalist boxes- Newbie question.

I am just getting started with SQL 7 and VB6 and have run into a problem.

I have an SQL 7 table called Date_Items with the following fields:

Date_item_num (counter, key field)
person_Id  (foriegn key connected to a person table)
Date_id  (related to a date when an employee is scheduled) - like "19991108"

I have an array of (31) datalist1 boxes on a form Along with an array of
(31) textboxes

I use a for loop (0 to 30) to put the integer representation of the date (as
example "19991108") in each text box right next to each datalist1 box.  So I
feel like I have the ability to index using that number in the data's
Date_id field.

What I want to do is take that index and run a query against the Table
Date_Items that will bring back:
All person_Id 's that correspond to a particular day and INDIVIUALLY place
them in the appropriate corresponding datalistbox1 (0 -30).    Example
Display  3 and 1, in the datalist box if the person with id 3 and 1 are
working.    PS....   I will worry about getting the correct name matched
with the number later.

I once got some results by changing the dayvariable in this select statement
inside my (0 to 30) loop, but it flashed the same data in all the datalist
boxes as it moved through the loop.

adodc2.recordsource = "Select person_id from date_items where date_id = "&
dayvariable &""

Thank you very much for any help you can give.  The sooner you respond, the
more hair you save on my head.

bob alexander



Sat, 27 Apr 2002 03:00:00 GMT  
 SQL 7 Database Access- filling multiple datalist boxes- Newbie question.
If I understand your question (had to read it a couple of times), you
basically are setting up sortof a calendar to see when people are coming in.
First of all, the dates you're putting in SQL.  Use a datetime variable type
in SQL to define your date_id.  Since I'm assuming you're gonna want to use
this on an ongoing basis, you're gonna need to set up begindate/enddate
fields on your form.  Then your code will look something like
curdate = begindate
for i = 1 to datediff(d, begindate, enddate) do
  datalist(i).recordsource = "Select personid from table where dateid = '" &
CurDate & "'"
  text(i).text = format(CurDate, "yyyymmdd")
  curdate = dateadd(d, 1, curdate)
next i

Quote:
> I am just getting started with SQL 7 and VB6 and have run into a problem.

> I have an SQL 7 table called Date_Items with the following fields:

> Date_item_num (counter, key field)
> person_Id  (foriegn key connected to a person table)
> Date_id  (related to a date when an employee is scheduled) - like
"19991108"

> I have an array of (31) datalist1 boxes on a form Along with an array of
> (31) textboxes

> I use a for loop (0 to 30) to put the integer representation of the date
(as
> example "19991108") in each text box right next to each datalist1 box.  So
I
> feel like I have the ability to index using that number in the data's
> Date_id field.

> What I want to do is take that index and run a query against the Table
> Date_Items that will bring back:
> All person_Id 's that correspond to a particular day and INDIVIUALLY place
> them in the appropriate corresponding datalistbox1 (0 -30).    Example
> Display  3 and 1, in the datalist box if the person with id 3 and 1 are
> working.    PS....   I will worry about getting the correct name matched
> with the number later.

> I once got some results by changing the dayvariable in this select
statement
> inside my (0 to 30) loop, but it flashed the same data in all the datalist
> boxes as it moved through the loop.

> adodc2.recordsource = "Select person_id from date_items where date_id = "&
> dayvariable &""

> Thank you very much for any help you can give.  The sooner you respond,
the
> more hair you save on my head.

> bob alexander




Mon, 29 Apr 2002 03:00:00 GMT  
 SQL 7 Database Access- filling multiple datalist boxes- Newbie question.
Thanks Randy,
Sorry that my post was not so clear.

At this point I have learned that I don't need to have each box connected to
the data directly.  Why do 28 -31 data searches for each month?

So what I want to do is search a database and pull all entries for the month
between beginning to end of month selected.  I can do that with
Select/between start and end.

What now?

Now how do I fill a listbox, that represents each day in that month, with
the appropriate employee names.

It really maybe a dumb question at this point.

How do I distribute it to my listbox(1-30)?


Quote:
> If I understand your question (had to read it a couple of times), you
> basically are setting up sortof a calendar to see when people are coming
in.
> First of all, the dates you're putting in SQL.  Use a datetime variable
type
> in SQL to define your date_id.  Since I'm assuming you're gonna want to
use
> this on an ongoing basis, you're gonna need to set up begindate/enddate
> fields on your form.  Then your code will look something like
> curdate = begindate
> for i = 1 to datediff(d, begindate, enddate) do
>   datalist(i).recordsource = "Select personid from table where dateid = '"
&
> CurDate & "'"
>   text(i).text = format(CurDate, "yyyymmdd")
>   curdate = dateadd(d, 1, curdate)
> next i


> > I am just getting started with SQL 7 and VB6 and have run into a
problem.

> > I have an SQL 7 table called Date_Items with the following fields:

> > Date_item_num (counter, key field)
> > person_Id  (foriegn key connected to a person table)
> > Date_id  (related to a date when an employee is scheduled) - like
> "19991108"

> > I have an array of (31) datalist1 boxes on a form Along with an array of
> > (31) textboxes

> > I use a for loop (0 to 30) to put the integer representation of the date
> (as
> > example "19991108") in each text box right next to each datalist1 box.
So
> I
> > feel like I have the ability to index using that number in the data's
> > Date_id field.

> > What I want to do is take that index and run a query against the Table
> > Date_Items that will bring back:
> > All person_Id 's that correspond to a particular day and INDIVIUALLY
place
> > them in the appropriate corresponding datalistbox1 (0 -30).    Example
> > Display  3 and 1, in the datalist box if the person with id 3 and 1 are
> > working.    PS....   I will worry about getting the correct name matched
> > with the number later.

> > I once got some results by changing the dayvariable in this select
> statement
> > inside my (0 to 30) loop, but it flashed the same data in all the
datalist
> > boxes as it moved through the loop.

> > adodc2.recordsource = "Select person_id from date_items where date_id =
"&
> > dayvariable &""

> > Thank you very much for any help you can give.  The sooner you respond,
> the
> > more hair you save on my head.

> > bob alexander




Tue, 30 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Filling multiple datalist boxes - Newbie

2. Filter a Combo Box filled from an Access database

3. Anyone seen bug in subroutine fill of multiple combo boxes

4. combo box/database combo box vlaue question - newbie

5. SQL Query with multiple Access databases

6. Using VBA to fill in Access Report Text Boxes

7. Newbie: Problem with multiple clients accessing same data object (SQL Server)

8. Datalist Control - Newbie Question

9. Newbie Help: Combo box not validating/updating Access Database

10. Newbie SQL/Report Database Question

11. Newbie Question: Access vs SQL Server

12. script newbie - multiple combo boxes

 

 
Powered by phpBB® Forum Software