View Full Version : Even more automated?


foxygrandma
07-02-2008, 07:16 AM
Khawar wrote a VBA program for me that performed a function I wanted. It works perfectly, and I can use it.

However, it does not quite completely automate the process I wanted. Please see attachment to understand what I'm talking about here.

As you can see I have a Shipment# field and a Freight Cost field. I simply enter the shipment number and freight cost from that table into that form and it updates a different table. It all works.

Now I have to go through that table of 7000 entries and do that for every record. Is there a way to automate this as well? What I would like to do is pretty simple I believe. Enter the shipment number and freight cost from the first row into the form, press "Allocate to shipment selected above," then go down one row in the table and repeat the process. I would do it myself, but I have no idea how. Please help!

DJkarl
07-02-2008, 07:33 AM
The way you would automate this is through the use of a recordset.

Something like

Dim rs as DAO.Recordset

set rs = Currentdb.OpenRecordset("YourTableNameHere")

do until rs.eof
'Do something with each record in here like call the function behind your form
rs.movenext
loop

set rs = nothing


This would go either into a public module or into form code tied to a button click if you prefer.

foxygrandma
07-02-2008, 07:45 AM
k i'll give it a shot, and get back to you shortly