Filling an Access 2003 form with a ADODB.recordset

41 views Asked by At

I am on Access 2003 and I have only litte/limited knowledge about Access/VBA. That's why I would like to ask you for help with the following:

I have a form which shall function as a continous form. In design mode I set up the form header, and in the detail region I put one line with some MS forms text boxes. I would like to fill these boxes with the fields of an ADODB.recordset, one line after the other as I loop through the recordset. The recordset itself is filled by an SQL-statement from a mySQL-Server.

I know this must sound kind of silly; I know that you can set a data source for the form (which I tried, and it works well. The SQL-statement works, too). But I want to put some checkboxes onto the form, and I don't know how to handle Booleans. So my idea is to loop through the recordset, check the Boolean values and set the checkboxes accordingly.

So, my question is: is there a way, to loop through a recordset and append a line to the form for each entry of the recordset, something like:

myRecSet.open "SELECT Name, City FROM ..." ...
myRecSet.MoveFirst
Do While Not myRecSet.EOF
  '--------------------- Need help with the following, if possible ------------
  ' Append one line to the continous form
  ' Fill fields, for example field "Name"= myRecSet![Name]
  ' Fill another field on the form, for example "City"= myRecSet![City]
  ' -------------------- up to here -------------------------------------------
  myRecSet.MoveNext
Loop

I am completely lost. Can anybody please advise me on this, maybe with some example VBA code.

Thanks in advance

Tried to find hints on the internet but found nothing useful. Checked the SQL-statement, it works.

0

There are 0 answers