PC Review


Reply
Thread Tools Rate Thread

comparing table data with last time before updating/appending

 
 
anil
Guest
Posts: n/a
 
      27th Apr 2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGVsb3Jkc29uIEthbGxvbg==?=
Guest
Posts: n/a
 
      27th Apr 2006
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/

"anil" wrote:

> 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
>
>

 
Reply With Quote
 
anil
Guest
Posts: n/a
 
      28th Apr 2006
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

 
Reply With Quote
 
anil
Guest
Posts: n/a
 
      28th Apr 2006
thanks a lot.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed - appending a record to a table then updating FatMan Microsoft Access VBA Modules 5 13th Aug 2008 03:57 PM
Comparing data before updating EMILYTAN via AccessMonster.com Microsoft Access Form Coding 4 11th Jun 2007 01:39 AM
Appending/Updating a table from a form! Tacitus Microsoft Access Forms 0 20th Feb 2006 07:40 PM
Appending to and Updating a Table Cathy Microsoft Access 5 4th Feb 2005 04:53 PM
Appending and Updating Data through Code Robert Neville Microsoft Access External Data 3 6th Jul 2003 12:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:14 AM.