Number of Records

  • Thread starter Thread starter Tom
  • Start date Start date
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
 
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.
 
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.
 
Back
Top