Macro or Module ?

D

dede

Hi
My macro look’s like:

- Open a form
- Stop (to let me change in the field [A] the number “1000†to a other number)
- Open the report
- print

I will run this macro under a loop until I have change all the number
“1000†in the field, could I do a loop in a macro or do I need to convert my
macro to a visual basic to use the loop or for each ?
And how I have to formulate the sentence (to find in the field [A] all “1000â€)
 
D

Douglas J. Steele

If you're trying to change all of the values of 1000 to some other value,
you should be using an Update query, not a macro or VBA.
 
D

dede

Hi Doug
First thanks for your answer.
But not exactly, I have imported from excel one/some ordering.
Those one does not contain a mastery number, by default (value 1'000) is
write during the loading.
The macro job will then :
1. open all this 1'000 as a Form (to allow me changing and add some comments)
2. print the final report (with the added field)

and this are done with a loop or with a for each No?

Douglas J. Steele said:
If you're trying to change all of the values of 1000 to some other value,
you should be using an Update query, not a macro or VBA.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


dede said:
Hi
My macro look's like:

- Open a form
- Stop (to let me change in the field [A] the number "1000" to a other
number)
- Open the report
- print

I will run this macro under a loop until I have change all the number
"1000" in the field, could I do a loop in a macro or do I need to convert
my
macro to a visual basic to use the loop or for each ?
And how I have to formulate the sentence (to find in the field [A] all
"1000")
 
D

Douglas J. Steele

When you say you're going to be changing the values, will you be changing
them all to the same value, or will different rows be assigned different
values? If the latter, is there any way to determine what the value should
be in an automated fashion? It's almost always best to use a query to update
data.

If you must go the form route, is the form a continuous form, or are you
trying to open a form that shows the values associated with only one row?
You could always open a continuous form that only shows the rows with 1'000
in the value by using a WhereCondition with your OpenForm statement.

To me, VBA is usually preferable (although I'll admit that macros have been
improved in Access 2007 now that they support error trapping)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


dede said:
Hi Doug
First thanks for your answer.
But not exactly, I have imported from excel one/some ordering.
Those one does not contain a mastery number, by default (value 1'000) is
write during the loading.
The macro job will then :
1. open all this 1'000 as a Form (to allow me changing and add some
comments)
2. print the final report (with the added field)

and this are done with a loop or with a for each No?

Douglas J. Steele said:
If you're trying to change all of the values of 1000 to some other value,
you should be using an Update query, not a macro or VBA.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


dede said:
Hi
My macro look's like:

- Open a form
- Stop (to let me change in the field [A] the number "1000" to a other
number)
- Open the report
- print

I will run this macro under a loop until I have change all the number
"1000" in the field, could I do a loop in a macro or do I need to
convert
my
macro to a visual basic to use the loop or for each ?
And how I have to formulate the sentence (to find in the field [A] all
"1000")
 

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