Hi !
I want to load some data from an Access form into a sql server table, but i am facing some challenges.
The data I want to load is from/displayeb by a "saved qry in Access", lets call it "qryAccessDemo". This query I use in a form form with some related criteria's. So when I have a form open, the form/query is only displaying the results I need. These result I want to load into a sql server table and I want to use vba and a double click event for it. I have populated the following code for this till now:
*The ConnectDatabase and CloseDatabase is a module which i created with the following youtube tutorial.
My code is not working, which is i think logical since sql server does not know the saved qry in access "qryAccessDemo".
A work arround for me would be to fully write out the query or create a view in SSMS. However, i guess there should be a way to make this work.
Could somebody help me out or guide me in the right direction how i can use the saved Access queries within a sql server related sql statement?
Thank you very much!
I want to load some data from an Access form into a sql server table, but i am facing some challenges.
The data I want to load is from/displayeb by a "saved qry in Access", lets call it "qryAccessDemo". This query I use in a form form with some related criteria's. So when I have a form open, the form/query is only displaying the results I need. These result I want to load into a sql server table and I want to use vba and a double click event for it. I have populated the following code for this till now:
Code:
Private Sub FieldA_DblClick(Cancel As Integer)
Dim sqlstr As String
Dim objControl As Control
sqlstr = "Insert into TableA(NamePerson) " & _
"select NamePerson from qryAccessDemo"
ConnectDatabase
DBCON.Execute sqlstr
CloseDatabase
End Sub
*The ConnectDatabase and CloseDatabase is a module which i created with the following youtube tutorial.
My code is not working, which is i think logical since sql server does not know the saved qry in access "qryAccessDemo".
A work arround for me would be to fully write out the query or create a view in SSMS. However, i guess there should be a way to make this work.
Could somebody help me out or guide me in the right direction how i can use the saved Access queries within a sql server related sql statement?
Thank you very much!