D
DBarker
Below is the code. I thought that it was working and the
only issue I needed to address was to get the JournalDate
to go before the Journal it corresponded to. However now
I am getting the following error:
"Run Time Error 3061 , Too few parameters expected 1"
Set rstFr = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
The above error occurs at the following line, when the
cursor is over the snapshot portion it shows = 4. That
table only has 3 fields, CaseID, JournalDate & Journals.
Let me explain what I am trying to do: I have two tables
the To table STi_Table has all the fields and this is
where I want to concatenate the multiple journals with
their dates. The STi-Multiple table is where there are
duplicated CASEIDs with different journal entries and
this is where the data should be pulled from.
Any Help would be greatly appreciated:
Below is the entire code I am using.
Sub Combine()
Dim strSQL As String
Dim dbs As DAO.Database
Dim rstFr As DAO.Recordset
Dim rstTo As DAO.Recordset
Dim varNoteBatch As Variant
Set dbs = CurrentDb()
strSQL = "SELECT STi_Table.* " _
& "FROM STi_Table " _
& "ORDER BY CaseID"
Set rstTo = dbs.OpenRecordset(strSQL, dbOpenDynaset)
strSQL = "SELECT STi_Multiples.* " _
& "FROM STi_Multiples " _
& "ORDER BY CaseID"
Set rstFr = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
Do Until rstTo.EOF
varNoteBatch = Null
strSQL = "[CaseID]=" & rstTo!CaseID
rstFr.FindFirst strSQL
Do Until rstFr.NoMatch
varNoteBatch = varNoteBatch & ";" _
& rstFr!Journals
rstFr.FindNext strSQL
Loop
rstTo.Edit
rstTo!Journals = varNoteBatch
rstTo.Update
rstTo.MoveNext
Loop
rstFr.Close
rstTo.Close
Set rstFr = Nothing
Set rstTo = Nothing
End Sub
only issue I needed to address was to get the JournalDate
to go before the Journal it corresponded to. However now
I am getting the following error:
"Run Time Error 3061 , Too few parameters expected 1"
Set rstFr = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
The above error occurs at the following line, when the
cursor is over the snapshot portion it shows = 4. That
table only has 3 fields, CaseID, JournalDate & Journals.
Let me explain what I am trying to do: I have two tables
the To table STi_Table has all the fields and this is
where I want to concatenate the multiple journals with
their dates. The STi-Multiple table is where there are
duplicated CASEIDs with different journal entries and
this is where the data should be pulled from.
Any Help would be greatly appreciated:
Below is the entire code I am using.
Sub Combine()
Dim strSQL As String
Dim dbs As DAO.Database
Dim rstFr As DAO.Recordset
Dim rstTo As DAO.Recordset
Dim varNoteBatch As Variant
Set dbs = CurrentDb()
strSQL = "SELECT STi_Table.* " _
& "FROM STi_Table " _
& "ORDER BY CaseID"
Set rstTo = dbs.OpenRecordset(strSQL, dbOpenDynaset)
strSQL = "SELECT STi_Multiples.* " _
& "FROM STi_Multiples " _
& "ORDER BY CaseID"
Set rstFr = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
Do Until rstTo.EOF
varNoteBatch = Null
strSQL = "[CaseID]=" & rstTo!CaseID
rstFr.FindFirst strSQL
Do Until rstFr.NoMatch
varNoteBatch = varNoteBatch & ";" _
& rstFr!Journals
rstFr.FindNext strSQL
Loop
rstTo.Edit
rstTo!Journals = varNoteBatch
rstTo.Update
rstTo.MoveNext
Loop
rstFr.Close
rstTo.Close
Set rstFr = Nothing
Set rstTo = Nothing
End Sub