Number of Records

T

Tom

I am using a Form to Update a data field, but I do not know how many records
their are. So when I run the Macro shown below I get an error resulting from
not being able to increment to the next record. So How do read the number of
records returned within a Form? can this be done within a macro?

The update form is linked to another form through the Query Criteria
statement [form]![xyzzy]![Part number] This limits the number of
records shown.

Macro:
OpenForm UpdateForm
RunMacro MacroLoop

MacroLoop:
Test for Null Yes StopMacro
SetValue Copy from one form to another
GotoRecord Next
runmacro MacroLoop


Regards Tom
 
J

John W. Vinson

I am using a Form to Update a data field, but I do not know how many records
their are. So when I run the Macro shown below I get an error resulting from
not being able to increment to the next record. So How do read the number of
records returned within a Form? can this be done within a macro?

The update form is linked to another form through the Query Criteria
statement [form]![xyzzy]![Part number] This limits the number of
records shown.

Macro:
OpenForm UpdateForm
RunMacro MacroLoop

MacroLoop:
Test for Null Yes StopMacro
SetValue Copy from one form to another
GotoRecord Next
runmacro MacroLoop


Regards Tom

The basic problem here is that you're apparently making the very common
mistake of assuming that data is stored in forms. It isn't.

A Form is JUST A WINDOW. Data is stored in tables, and only *displayed* on
forms.

To update your data, run an Update Query updating the Table containing the
data. This query can have criteria limiting which records are updated.
 
T

Tom

Oh you are so right, I knew that.. Thanks for setting me straight.

John W. Vinson said:
I am using a Form to Update a data field, but I do not know how many
records
their are. So when I run the Macro shown below I get an error resulting
from
not being able to increment to the next record. So How do read the number
of
records returned within a Form? can this be done within a macro?

The update form is linked to another form through the Query Criteria
statement [form]![xyzzy]![Part number] This limits the number of
records shown.

Macro:
OpenForm UpdateForm
RunMacro MacroLoop

MacroLoop:
Test for Null Yes StopMacro
SetValue Copy from one form to another
GotoRecord Next
runmacro MacroLoop


Regards Tom

The basic problem here is that you're apparently making the very common
mistake of assuming that data is stored in forms. It isn't.

A Form is JUST A WINDOW. Data is stored in tables, and only *displayed* on
forms.

To update your data, run an Update Query updating the Table containing the
data. This query can have criteria limiting which records are updated.
 

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