danwhite
06-16-2004, 08:31 AM
Ok here is the situation,
I have 2 tables one called "allstocks" the other called "todaysstocks", I have 2 forms, one form shows the allstocks table, with a button called today, which upon clicking it deletes all data in todaystocks table, asks for a date and grabs the information from the allsotcks table with the date criteria and copies all the info from the allstocks table and populates the todaystock table and a form called "today" launches and shows whats in the todaysstock table.
After I enter data into the Today Form I have a button and I want it to Update the allstocks table with the information I added on the todays form. both tables are identicle in structure.
So if I have a stock created on say 6/10/2004 and I change the information about that symbol to a different date, or a different price or a different exchange, it will update the information in the row. However if the stock does not exist, and I add one to it, I want it to insert it into the allstocks table.
This is the script I was using, but it just keeps inserting the data onto the bottom of the list and adding info.
Can someone direct me into how I can fix this?
strsql = "insert into allstocks (exchange,transdate,ticker,[opened date],[closed date],[over/under]) select exchange,[todays date],ticker,[opened date], [closed date],[over/under] from todaysstocks"
DoCmd.RunSQL (strsql)
I have 2 tables one called "allstocks" the other called "todaysstocks", I have 2 forms, one form shows the allstocks table, with a button called today, which upon clicking it deletes all data in todaystocks table, asks for a date and grabs the information from the allsotcks table with the date criteria and copies all the info from the allstocks table and populates the todaystock table and a form called "today" launches and shows whats in the todaysstock table.
After I enter data into the Today Form I have a button and I want it to Update the allstocks table with the information I added on the todays form. both tables are identicle in structure.
So if I have a stock created on say 6/10/2004 and I change the information about that symbol to a different date, or a different price or a different exchange, it will update the information in the row. However if the stock does not exist, and I add one to it, I want it to insert it into the allstocks table.
This is the script I was using, but it just keeps inserting the data onto the bottom of the list and adding info.
Can someone direct me into how I can fix this?
strsql = "insert into allstocks (exchange,transdate,ticker,[opened date],[closed date],[over/under]) select exchange,[todays date],ticker,[opened date], [closed date],[over/under] from todaysstocks"
DoCmd.RunSQL (strsql)