troubleshooting Question

Read and SQL table and update data into an Access table

Avatar of MECR123
MECR123 asked on
Microsoft AccessMicrosoft SQL Server 2005
5 Comments1 Solution319 ViewsLast Modified:

I have an access database Created  - I am using Access 2007 and I have saved the database to 2003 as the users are on 2003
I have a main table in this Access database that I can maintain (Add/update/delete) records

I want now to be able to connect my access database to an SQL database – this SQL database is accessible through a user ID and password

In my access database we will call the table – tableACC
This has 5 fields

In my SQL database we will call the table – tableSQL
This table has 30 fields – I only want to take certain fields from this table

I want a create a form with a ‘Button’ which will invoke the VB code to do the following

I want to Select records from TableSQL that are Open (TableSQL.Open = yes) and Created between 2 dates  (TableSQL,CreatedDate Between Date1 and Date2) – These dates must be entered by the user (these dates are parameters) And only select records that are not already on the tableACC.

For all the records that are selected I want to add these into the Access table TableACC.

In summary
I have not written VB code before – I would like to know how to write this code – how to be able to call the code from a ‘button’  - how to input the dates as parameters – how to open the SQL database with a user ID and password  - how to read the SQL table – how to write to the Access table

Thanks very much for your help


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros