How to generate continous form thru VBA code ?

  • Thread starter Paul via AccessMonster.com
  • Start date
P

Paul via AccessMonster.com

I have created one continous form and I am generating values in a loop. I
want to show values in Text boxes in the continous form's detail section
when the loop execute. In each execution the detail section create new row.
Look forward for a solution.
 
A

Arvin Meyer

Paul via AccessMonster.com said:
I have created one continous form and I am generating values in a loop. I
want to show values in Text boxes in the continous form's detail section
when the loop execute. In each execution the detail section create new row.
Look forward for a solution.

Something like this perhaps:


Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Long

Set db = CurrentDb()
Set rst = db.OpenRecordset("Whatever")
For i = 1 To 100
rst.AddNew
rst!ID = i
rst!OtherField = "Something"
rst.UPDATE
Next i

Me.FormName.Requery

rst.Close
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
P

Paul via AccessMonster.com

I am not using any table to assigne the values to the form. I am passing
values thru code. ie Form!Text1.Value = "AAA"
 
A

Albert D.Kallal

Paul via AccessMonster.com said:
I have created one continous form and I am generating values in a loop.

9 out of 10 times the above means that data is coming form some where! If it
is coming from some where, then make the continues form based on that data.

If you are in fact generating the data out of thin air, then you will have
to send the data to a temp table, and base the form on that (you can't have
a un-bound continues form).

You can however use a multi-column listbox, and fill that with data from an
array (use a call back function). You can read about this here;
http://www.mvps.org/access/forms/frm0049.htm

If you look at the following screen shots, in a few places I used a
listbox..and you are hard pressed to tell the difference as to when I used a
continues form..or a list box.

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm

So, the above should give you some ideas.

So, if you MUST have un-bound data, then try a listbox + callback.
Otherwise, fill the continues form with a query that pulls the data (after
all, that data likely is coming from some where). And, last, but not least,
if the data is GENERATED, then send the data to a temp table..and have the
form based on that.
 
A

Arvin Meyer

All data which is stored, is stored in tables, so you are either storing the
data in a table bound to the form, or you are only able to show 1 record.
Unbound continuous forms can show the same record multiple times, but not
different records.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top