display multiple records 
Author Message
 display multiple records

Hello,

I'm trying to display multiple records. The number of
records to be displayed is based on the results of a query
with a parameter of date that I select from a drop down.
because the resulting number of records vary, I would like
to only show the results that are returned. How do I make
a dynamic display.

Right now the code below only allows me to show the last
line of the result. Thanks in advance for your help

This is the code that I'm running

Set qdf = dbs.CreateQueryDef("", strSQL)
    With qdf
        Set rstTemp = .OpenRecordset()
        'rstTemp.MoveFirst
        Do While Not rstTemp.EOF
            field1.Value = rstTemp.Fields("field1")
            field2.Value = rstTemp.Fields("field2")
            field3.Value = rstTemp.Fields("field3")
            field4.Value = rstTemp.Fields("field4")
            field5.Value = rstTemp.Fields("field5")

        rstTemp.MoveNext
        Loop
        rstTemp.Close

    End With
qdf.Close



Fri, 31 Dec 2004 09:33:54 GMT  
 display multiple records
Normally I'd use a form or subform in continuous forms view, and dynamically
manipulate its RecordSource property so as to show the records I want.
Another possibility is a list box, in which case it's the RowSource property
you'd set to the SQL statement you've built.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Quote:
> Hello,

> I'm trying to display multiple records. The number of
> records to be displayed is based on the results of a query
> with a parameter of date that I select from a drop down.
> because the resulting number of records vary, I would like
> to only show the results that are returned. How do I make
> a dynamic display.

> Right now the code below only allows me to show the last
> line of the result. Thanks in advance for your help

> This is the code that I'm running

> Set qdf = dbs.CreateQueryDef("", strSQL)
>     With qdf
>         Set rstTemp = .OpenRecordset()
>         'rstTemp.MoveFirst
>         Do While Not rstTemp.EOF
>             field1.Value = rstTemp.Fields("field1")
>             field2.Value = rstTemp.Fields("field2")
>             field3.Value = rstTemp.Fields("field3")
>             field4.Value = rstTemp.Fields("field4")
>             field5.Value = rstTemp.Fields("field5")

>         rstTemp.MoveNext
>         Loop
>         rstTemp.Close

>     End With
> qdf.Close



Fri, 31 Dec 2004 10:12:56 GMT  
 display multiple records
I would use an unbound combo box to select the
records/date I wanted to display.  The RowSource property
of the combo box would be similar to the form's
RecordSource property but also using either GroupBy or
Unique Records.

In the AfterUpdate_Event, for the combo box build a
dynamic query string {strSQL} where the date selected from
the combo box is used as a criteria for the dynamic query.
Note: If you do not know how to do this, you should learn.
The technique, once you have earned it, is easy to
implement and very "powerful/useful".

Use this code after you have created the dynamic query
string: Me.RecordSource = strSQL

The form will only contain/display the records associated
with the date you selected.

You can also set the form's Recordset property to a
recordset: Me.Recordset = rstTemp; if the recordset
produced by your code below is already what you want.

Quote:
>-----Original Message-----
>Normally I'd use a form or subform in continuous forms

view, and dynamically
Quote:
>manipulate its RecordSource property so as to show the
records I want.
>Another possibility is a list box, in which case it's the
RowSource property
>you'd set to the SQL statement you've built.

>--
>Dirk Goldgar, MS Access MVP
>www.datagnostics.com

>(please reply to the newsgroup)



>> Hello,

>> I'm trying to display multiple records. The number of
>> records to be displayed is based on the results of a
query
>> with a parameter of date that I select from a drop down.
>> because the resulting number of records vary, I would
like
>> to only show the results that are returned. How do I
make
>> a dynamic display.

>> Right now the code below only allows me to show the last
>> line of the result. Thanks in advance for your help

>> This is the code that I'm running

>> Set qdf = dbs.CreateQueryDef("", strSQL)
>>     With qdf
>>         Set rstTemp = .OpenRecordset()
>>         'rstTemp.MoveFirst
>>         Do While Not rstTemp.EOF
>>             field1.Value = rstTemp.Fields("field1")
>>             field2.Value = rstTemp.Fields("field2")
>>             field3.Value = rstTemp.Fields("field3")
>>             field4.Value = rstTemp.Fields("field4")
>>             field5.Value = rstTemp.Fields("field5")

>>         rstTemp.MoveNext
>>         Loop
>>         rstTemp.Close

>>     End With
>> qdf.Close

>.



Fri, 31 Dec 2004 23:09:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. displaying multiple records - VB5

2. Display multiple record in one text box

3. Displaying multiple records

4. Display multiple records in form-view (access-like)

5. Display one record from multiple records

6. Need to display multiple lines mini report within one record in a report

7. Merge Multiple Docs against Multiple Records in Datasource

8. Link multiple datagrids to a single record (Master\Detail Form with multiple details)

9. Display records on screen using display button

10. generate multiple records from 1 record

11. Acc97 - Merging Multiple Records into a Single Record

12. Module-level multiple-record recordset vs temp single-record recordset

 

 
Powered by phpBB® Forum Software