VBA loops

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Looking for proper syntax for a loop in a loop vba.

I have a table with Job information and another table related to it with
order information. I am looking for a way to loop through all jobs and then
list the orders for each job. I am actually going to print this info to an
email, here is an example of what I would like:



Job 100

Order 1 Order Desc
Order 2 Order Desc
Order 3 Order Desc



Thanks
 
Not knowing how you have the tables setup, but hopefully this will give you
some guidance.

The Jobs Table should have a primary key ("JobID") set as an autonumber.
The Order Table should have a primary key ("OrderID") set as an autonumber.
In the Order Table, add the "JobID" field, set as Number - Long Integer.
This field will be known as the foreign key to the Jobs Table.

Now that we have established the key fields, open the relationship (Tools ->
Relationships) and select both those tables. Create a link betwen the Jobs
Table (JobID field) to the Orders Table (JobID field). Now that we have
create the relationship, we can build a query that joins the two tables
together.

The end result is that the query will give you the basis to output the data
as you have specified below.

Let me know how you make out on this.

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

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

Similar Threads

Looping VBA 3
PowerPoint Randomise slides and have an infinite loop 0
Access Inventory Calculation 0
MS ACCESS INVENTORY CALCULATION 0
Looping or Do While statement? 10
Excel Populate Delivery Note 0
SQL TOP 50,000 Help 11
Change a Form's recordsource dynamically? 12

Back
Top