By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,121 Members | 1,782 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,121 IT Pros & Developers. It's quick & easy.

OnChange event

P: n/a


I need to build a new table that contains only those rows that have been
changed
The original table is called Customers and has fields as :
CustomerId
CompanyName
city
ets
ets
I need to make a new table called CustomersTemp containing only those
customers that have been changed in some respect. For example, there may
be a change in
the CompanyName or in the city, or any other field not mentioned.
So, the new table must contain only those customers that have been
changed.
I have a form called frmCustomers.I know that there is an OnChange event
and i want to use it in the OnClose event of the form, if possible,or at
least to click somewhere. If i succeed with the task, after that the
table CustomersTemp will be sent via email to another city and deleted
from the database.

This is the task i have and i need help, i cannot do it myself.
Up to now i have built only the make up table function as follows:

Public Function OnChange()
Dim StrCustomers As String
StrCustomers = " SELECT customers.* INTO CustomersTemp FROM customers"
CurrentDb.Execute StrCustomers
CurrentDb.Execute "CREATE INDEX PrimaryKey ON CustomersTemp (CustomerID)
WITH PRIMARY"
End Function

The above function only creates the table CustomersTemp, but of course
it is a copy of the first table and does not show only those customers
that have been changed.
The other task i have is to add on also the new customers.I think a new
customer must also be considered as a change in the table.

Does somebody has any idea to suggest out of your experience? I supose
somebody else might have come accross the same task that i have.




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 18 Oct 2003 12:51:30 GMT, Svelte Poshy <sv******@yahoo.com> wrote:


I need to build a new table that contains only those rows that have been
changed
The original table is called Customers and has fields as :
CustomerId
CompanyName
city
ets
ets


Maybe two possiblities:
- create a date/time field in the table. When a new record is added
you just simply set the this field to now(). Now you can always query
out your table using this date/time field and with a 'make-table'query
put those records needed in a second table
- maybe a bit more straightforward. Create an extra yes/no-field with
the name changedornew. Set the default value to true. So when a new
record is added the value would be true. When you change a record you
could set the value to true. Via a make-table-query you could easily
filter out the records where the yesnofield is set to true. After
doing this you could simply set all the yesno-fileds back to no (via
an actionquery.
succes,
bebelino
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.