Hi,
I've been trying to concatenate a one to many relationship in a single column by using faq701-3499. But I'm getting an error message runtime error 3075 when i get to the line:
Set rs1 = db.OpenRecordset(sql)
it references the line
sql = "select Note_Txt from OutstandingEstatesbyPSM2 where Esta_Cod = '" & rs!Esta_Cod & ""
where Note_Txt is my many field OutstandingEstatesbyPSM2 is my table and Esta_Cod is my unique identifier...
can anybody help?, I've listed the full code below and commented where the error is appearing:
I've been trying to concatenate a one to many relationship in a single column by using faq701-3499. But I'm getting an error message runtime error 3075 when i get to the line:
Set rs1 = db.OpenRecordset(sql)
it references the line
sql = "select Note_Txt from OutstandingEstatesbyPSM2 where Esta_Cod = '" & rs!Esta_Cod & ""
where Note_Txt is my many field OutstandingEstatesbyPSM2 is my table and Esta_Cod is my unique identifier...
can anybody help?, I've listed the full code below and commented where the error is appearing:
Code:
Sub MakeOutstandTexttbl()
Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim vStore As String
Set db = CurrentDb
db.Execute "Delete Temptable.* from temptable;"
db.Execute ("insert into TempTable(Esta_Cod) select distinct Esta_Cod from OutstandingEstatesbyPSM2")
Set rs = db.OpenRecordset("select distinct Esta_Cod from TempTable")
Do Until rs.EOF = True
vStore = ""
Dim sql As String
sql = "select Note_Txt from OutstandingEstatesbyPSM2 where Esta_Cod = '" & rs!Esta_Cod & ""
Set rs1 = db.OpenRecordset(sql) ' code breaks here with run time error 3075 syntax error in string in query expression 'Esta_Cod = 'DN1#0001AB'
Do While rs1.EOF = False
vStore = vStore + "," + rs1!store
rs1.MoveNext
Loop
If Len(vStore) > 0 Then
vStore = Right(vStore, Len(vStore) - 1)
db.Execute ("update temptable set Note_Txt + '" + vStore + "' where Esta_Cod = '" & rs!Esta_Cod & "")
Else
End If
rs.MoveNext
Loop
Set rs = Nothing
Set rs1 = Nothing
Set db = Nothing
End Sub