comparing table data with last time before updating/appending

  • Thread starter Thread starter anil
  • Start date Start date
A

anil

hi all
i have written vba code to generate random sites using query from 2
tables.u can see code in "output of immediate window in report".I have
been able to get output in report via append query through temp table.
There are 2 tables -town and sites.town has many sites.From each
town(say A) we need to select samplesites(say 2) from fixed number of
sites(say15).The output looks like:
TOWN SITECODE SITE ADDRESS
A a1 a street,A
A a2 a2 street,A
B b1 b street,B
B b2 b1 street,B
B b3 b3 ave,B
Now the problem is : before entering the data in temp table i need to
compare the data with last one already in the table.that is i should
not get that data which is already in the temp table.
Someone told me that use the checkbox in main table so that when we
append those fields in new table it gets checked and we can use it as
filter.
but i don't have much idea of code.can u please refer some code if
already discussed.if not can u give me please some idea how to do.
thanks
anil
 
You can do this without any code. Instead of trying to add you new data
directly to the temp table, put it into a new temp table, then create a new
query using the 'find unmatched query wizard' and find all records in the new
temp table that are not in the existing temp table. Save the query and
convert it into an append query to append the data to the existing temp table.

Delordson Kallon
http://www.instantsoftwaretraining.com/
 
i have one more query.see first i have 2 tables tblTown and tbl Site.
tblTown look like :
TOWNCODE TOWN SAMPLESITES DESCRIPTION
1 A 2
2 B 3 and so on
tblsite look like : SITECODE SITEADDRESS TOWN REMARKS
a1 a1 street A
a2 a2 street A
b1 b1 street B
and so on
Now the final result look like :
TOWN SITECODE SITE ADDRESS
A a1 a street,A
A a2 a2 street,A
B b1 b street,B
B b2 b1 street,B
B b3 b3 ave,B
The out put is same as above.
Since in queries we select towncode from tblTown and sitecode and site
address from tblSite on basis of no of Sample sites so how can we
select from the out put table.
see it works fine in query,but not in vba code.As i want database not
ot changed by everyone according to need i want to write code.
is ur method will be same in code or i am thinking wrong somewhere.
please comment on basis of vba code.
thanks
anil
 
Back
Top