copy by timevalue to last row

H

HarveyM.

Sort of a long question, but worth a try. I have a dispatching spreadsheet
that copies electric outage events from a database to various service centers
for dispatching. Let's say I run the report @ 0600 and more events come in
after 0600. The report is already in place by service center and I just want
to filter (by code) the more recent events and copy over to the last row of
the existing report. (there are 14 service centers)
 
J

Joel

You haven't given very much details to get the best answer. We don't know
what your existing code looks like especially the query to the database.
Sometimes it makes sense to just rerun the report. Other times it make sense
to look at last line of the report for the time and then query the database
of events occuring after this time.
 
H

HarveyM.

Hi Joel, this is a daily report and usually runs at 0600. The code erases the
previous day report and querys by service center from the database. It then
timestamps the query time on an update tab that shows the service center when
the last query was made. Once the report is run, the supervisor has to
finialize by requesting the type of crew needed for each event. If I rerun
the report, this info wouldn't be correct..therefore....a new query would
have to be added to the bottom of the last query and not contains duplicates
from a previous time query. The code is a simple macro recording of a
database filter, selecting each service center and then coping the info to a
different tab marked for that service center.
 
J

Joel

It appears only two changes would be required to your present query.

1) The Desination line would have to be changed to place new data after the
last data.

from
Destination := Range("A1")

to
LastRow = Range("A" & Rows.count).end(xlup).Row
Destination := Range("A" & LastRow) + 1

2) The query would need some type of WHERE parameter added to select items
after a certain time

queryString = _
"SELECT * FROM product.dbf WHERE (product.ON_ORDER<>0)"
 

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