Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: ADO recordset and unbound subforms


Message #1 by "Jason Bradford" <j.bradford@a...> on Wed, 25 Jul 2001 11:32:14
I am trying to populate two unbound subforms using ADO recordsets.  There 

is no problem with the recordset as I have checked the contents using the 

debug.print method in the Immediate window.   The problem I am having is 

populating the subforms.  Both subforms should have many records in but I 

can only get one record to display, this being the last record in the 

recordset.  The subforms are both designed as continuous forms.  When the 

controls are bound to the appropriate tables then the records are 

displayed as expected.  I want to use unbound controls for speed and 

scalability.  The data from the recordset is stored in an array which 

again i know is correct as again I have used the Immediate window to 

display the contents of the array.  I may be miising something simple but 

I just cant work out how to get the subform to display all the records.  

The code below shows where I want the subform to take the data from the 

array and disply it on screen and then move to the next record ready to 

accept the next data from the array.  Any help or advise would be most 

appreciated.



Basically there is a loop dependent on the number of records in the 

recordset.  Each pass of the loop should output the record to screen, 

producing a list.



Do Until intRecordCount = intCount

   

      txtText = avarRecords(3, (intCount)) 'displays record in subform  

            

      Debug.Print txtText ' this is how i know the recordset and array 

has  the correct data

      

      'move to the next record on the subform ... HOW DO I DO THIS ? 

      

      intCount = intCount + 1



Loop



Heres hoping someone can help

Jason



Message #2 by "Peter Kaufman" <kaufman@l...> on Wed, 25 Jul 2001 18:18:40 +0700
Yeah......Oh, how many hours I spent on this the last few months!



The problem is, and this is coming from Russell Sinclair who wrote "From

Access to SQL Server", that Access forms will not support unbound recordsets

in datasheet controls, so it cannot be done - not directly.



There are some other approaches, though. Assuming you are using a split db,

you could use local tables in the front end as recordsources for your

subforms. I guess you know that anyway.



The other one, which Russell suggested but I never pursued, is to use a VB

control that >does< support this.



HTH,



Peter



-----Original Message-----

From: Jason Bradford [mailto:j.bradford@a...]

Sent: July 25, 2001 11:32 AM

To: Access

Subject: [access] ADO recordset and unbound subforms





I am trying to populate two unbound subforms using ADO recordsets.  There

is no problem with the recordset as I have checked the contents using the

debug.print method in the Immediate window.   The problem I am having is

populating the subforms.  Both subforms should have many records in but I

can only get one record to display, this being the last record in the

recordset.  The subforms are both designed as continuous forms.  When the

controls are bound to the appropriate tables then the records are

displayed as expected.  I want to use unbound controls for speed and

scalability.  The data from the recordset is stored in an array which

again i know is correct as again I have used the Immediate window to

display the contents of the array.  I may be miising something simple but

I just cant work out how to get the subform to display all the records.

The code below shows where I want the subform to take the data from the

array and disply it on screen and then move to the next record ready to

accept the next data from the array.  Any help or advise would be most

appreciated.



Basically there is a loop dependent on the number of records in the

recordset.  Each pass of the loop should output the record to screen,

producing a list.



Do Until intRecordCount = intCount



      txtText = avarRecords(3, (intCount)) 'displays record in subform



      Debug.Print txtText ' this is how i know the recordset and array

has  the correct data



      'move to the next record on the subform ... HOW DO I DO THIS ?



      intCount = intCount + 1



Loop



Heres hoping someone can help

Jason









Message #3 by "Jason Bradford" <j.bradford@a...> on Wed, 25 Jul 2001 15:16:38
> Yeah......Oh, how many hours I spent on this the last few months!

> 

> The problem is, and this is coming from Russell Sinclair who wrote "From

> Access to SQL Server", that Access forms will not support unbound 

recordsets

> in datasheet controls, so it cannot be done - not directly.

> 

> There are some other approaches, though. Assuming you are using a split 

db,

> you could use local tables in the front end as recordsources for your

> subforms. I guess you know that anyway.

> 

> The other one, which Russell suggested but I never pursued, is to use a 

VB

> control that >does< support this.

> 

> HTH,

> 

> Peter

> 

> -----Original Message-----

> From: Jason Bradford [mailto:j.bradford@a...]

> Sent: July 25, 2001 11:32 AM

> To: Access

> Subject: [access] ADO recordset and unbound subforms

> 

> 

> I am trying to populate two unbound subforms using ADO recordsets.  There

> is no problem with the recordset as I have checked the contents using the

> debug.print method in the Immediate window.   The problem I am having is

> populating the subforms.  Both subforms should have many records in but I

> can only get one record to display, this being the last record in the

> recordset.  The subforms are both designed as continuous forms.  When the

> controls are bound to the appropriate tables then the records are

> displayed as expected.  I want to use unbound controls for speed and

> scalability.  The data from the recordset is stored in an array which

> again i know is correct as again I have used the Immediate window to

> display the contents of the array.  I may be miising something simple but

> I just cant work out how to get the subform to display all the records.

> The code below shows where I want the subform to take the data from the

> array and disply it on screen and then move to the next record ready to

> accept the next data from the array.  Any help or advise would be most

> appreciated.

> 

> Basically there is a loop dependent on the number of records in the

> recordset.  Each pass of the loop should output the record to screen,

> producing a list.

> 

> Do Until intRecordCount = intCount

> 

>       txtText = avarRecords(3, (intCount)) 'displays record in subform

> 

>       Debug.Print txtText ' this is how i know the recordset and array

> has  the correct data

> 

>       'move to the next record on the subform ... HOW DO I DO THIS ?

> 

>       intCount = intCount + 1

> 

> Loop

> 

> Heres hoping someone can help

> Jason

> 

> 

> 

> 

Message #4 by "Jason Bradford" <j.bradford@a...> on Wed, 25 Jul 2001 15:38:36
Thanks for the reply, it's puzzled me for ages and no book seems to have 

an answer.  I've tried various VB controls but to no avail so I think I 

will end up populating the subforms direct from data in tables.  



Jason





> Yeah......Oh, how many hours I spent on this the last few months!

> 

> The problem is, and this is coming from Russell Sinclair who wrote "From

> Access to SQL Server", that Access forms will not support unbound 

recordsets

> in datasheet controls, so it cannot be done - not directly.

> 

> There are some other approaches, though. Assuming you are using a split 

db,

> you could use local tables in the front end as recordsources for your

> subforms. I guess you know that anyway.

> 

> The other one, which Russell suggested but I never pursued, is to use a 

VB

> control that >does< support this.

> 

> HTH,

> 

> Peter

> 

> -----Original Message-----

> From: Jason Bradford [mailto:j.bradford@a...]

> Sent: July 25, 2001 11:32 AM

> To: Access

> Subject: [access] ADO recordset and unbound subforms

> 

> 

> I am trying to populate two unbound subforms using ADO recordsets.  There

> is no problem with the recordset as I have checked the contents using the

> debug.print method in the Immediate window.   The problem I am having is

> populating the subforms.  Both subforms should have many records in but I

> can only get one record to display, this being the last record in the

> recordset.  The subforms are both designed as continuous forms.  When the

> controls are bound to the appropriate tables then the records are

> displayed as expected.  I want to use unbound controls for speed and

> scalability.  The data from the recordset is stored in an array which

> again i know is correct as again I have used the Immediate window to

> display the contents of the array.  I may be miising something simple but

> I just cant work out how to get the subform to display all the records.

> The code below shows where I want the subform to take the data from the

> array and disply it on screen and then move to the next record ready to

> accept the next data from the array.  Any help or advise would be most

> appreciated.

> 

> Basically there is a loop dependent on the number of records in the

> recordset.  Each pass of the loop should output the record to screen,

> producing a list.

> 

> Do Until intRecordCount = intCount

> 

>       txtText = avarRecords(3, (intCount)) 'displays record in subform

> 

>       Debug.Print txtText ' this is how i know the recordset and array

> has  the correct data

> 

>       'move to the next record on the subform ... HOW DO I DO THIS ?

> 

>       intCount = intCount + 1

> 

> Loop

> 

> Heres hoping someone can help

> Jason

> 

> 

> 

> 


  Return to Index