Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop in a Macro ?

Status
Not open for further replies.

yoshi88

Technical User
Mar 18, 2001
48
CA
Hi,

With a barcode scanner I will scan the items that are "out" in my table, as they come back in. After being scanned, I want the items to be update to the new status "in". To do that I created a table with those fields:

itemnumber
dateout
status (in or out)
datein

Then I created Query1 to filter the table with a specific criteria "itemnumber1" (the one I will scan) with the status "out". I then use an update query named Query2 to change the status of that item to "in" and to add the time and date in the field datein.

I would like to be able to use a macro or a code that will do a loop or restart the Query1 if I have multiple items to scan and will stop if in the criteria itemnumber1 is Null.

Is it possible and how can I do that.


Frank
 
Frank,

I apologize for not reading your posting too clearly. What is clear to me, though, is that you will be quite happy if you move from Macros to vba code. Code is MUCH more powerful than macros, and will allow you to do loops to your heart's content. It's a big learning process, but it's the only way to do things like what you're invisioning here.

One way to get started is to convert each of your macros to code. The code won't be pretty, but it will do exactly what your macro does, and you'll get to start learning from what you see. There will, however, be a lot of reading ahead of you.

Jeremy

---
Jeremy Wallace
METRIX Project Coordinator
Fund for the City of New York
 
I will try to be clearer.

If the itemnumber I scan is Not Null then I want the code to update the itemnumber to "in" and add the time and date to my table. After that I want the code tu run the Query1 another time (over an over again till the itemnumber is Null)

Else, I want the code to stop and come back to my main menu.



Frank


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top