Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

project(.adp) file & SQL Server -- connect with VBA?

Status
Not open for further replies.

superdog4492

Programmer
Nov 14, 2002
12
CA
Hi there,

I apologize for the cross-post -- I should have started with this forum.

I have an MS Access project that connects me to a SQL Server database. My forms are all working fine, but I've been trying to figure out how to get at the data programmatically, using VBA.

I'm assuming that since the project is already connected to the database, that I don't have to connect in my code. Is that correct? If not, how do I connect? ODBC?

Any simple examples of a connection and creation of a recordset would be greatly appreciated!

Thanks, superdog

 
Data access method is ADO. Best answer I can give you is get a book on beginning ADO. WROX press has some good ones. They'll show you how to use the ADO object model to access SQL server data.
 
Actually, it was the Access object model that was giving me problems -- I was using CurrentDB instead of CurrentProject.

If I use Application.CurrentProject.execute([some sql statement]), the VBA code uses the project's connection to the SQL server database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top