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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing query result with code

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Basically i have run a query but some of the records need to be deleted ( given a set criteria ) but i can't seem to do it using a normal query criteria. Is there a way of using recordsets to edit the query result and will this preserve the underlying table/query data?

To give you an idea of what happening ..

-monthly info in tables1,2,3....

-record X in each table which leads to the query finding the difference

Table1 Table2 Query (t1-t2)

t1_X t2_X t1_X - t2_X

this is easy.....but some times record X needs to be "reset" so we end up with ...


Table1 Table2 Query (t1-t2)

t1_X1 t2_X1 t1_X1 - t2_X1
t1_X2 t2_X2 t1_X2 - t2_X2

the query will also give t1_X1 - t2_X2
t1_X2 - t2_X1

I know that an obvious answer would be to split them into two records but because this application is referring to a metering system, the "two" records should really be assigned to one meter. In addition, the recordX cannot be altered because in the next month there will probably be no "splitting" and must be able to find the original meter number.
A proposal in VBA would be to examine each record and if there are multiple reads per recordX then use some date criteria to delete unwanted rows...is this possible

can anyone give me some starting advice as i haven't used recordsets before

thanks for reading this


Josh

Ps i've looked at logic functions but i dont think it can be done that way....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top