J
JCIrish
Here is this beginner again. I know how to write VBA code (usually in Excel)
but I can't get over the first hump of trying to access the database in order
to write the code for a select query. Here is what I tried (one of several
variations)
Sub TrySetUp()
Dim cnTryVBA As ADODB.Connection
Set cnTryVBA = CurrentProjet.Connection
Dim rsmyRecordSet As New ADODB.Recordset
Set rsmyRecordSet.ActiveConnection = cnTryVBA
rsmyRecordSet.ActiveConnection = cnTryVBA
rsmyRecordSet.Open "SELECT FROM [Copy Of Portfolio Holdings and Value]"
' VBA Code to select and order data goes here
End Sub
"Copy Of Portfolio Holdings and Value" is the table that contains the data
I don't know what is wrong with this. To make matters worse, I'm not even
sure where to put this code, even if it were correct. As it is, the code
generates a syntax error "Expected,Delete,select,etc."
I did the reference thing in the tools menu. I must be missing something
very basic at the outset of this process. Getting VBA code into a Form seems
to be easier, but I'm lost on the process for making a query. All help will
be greatly appreciated.
but I can't get over the first hump of trying to access the database in order
to write the code for a select query. Here is what I tried (one of several
variations)
Sub TrySetUp()
Dim cnTryVBA As ADODB.Connection
Set cnTryVBA = CurrentProjet.Connection
Dim rsmyRecordSet As New ADODB.Recordset
Set rsmyRecordSet.ActiveConnection = cnTryVBA
rsmyRecordSet.ActiveConnection = cnTryVBA
rsmyRecordSet.Open "SELECT FROM [Copy Of Portfolio Holdings and Value]"
' VBA Code to select and order data goes here
End Sub
"Copy Of Portfolio Holdings and Value" is the table that contains the data
I don't know what is wrong with this. To make matters worse, I'm not even
sure where to put this code, even if it were correct. As it is, the code
generates a syntax error "Expected,Delete,select,etc."
I did the reference thing in the tools menu. I must be missing something
very basic at the outset of this process. Getting VBA code into a Form seems
to be easier, but I'm lost on the process for making a query. All help will
be greatly appreciated.