terryvanduzee
Registered User.
- Local time
- Today, 08:48
- Joined
- Sep 23, 2005
- Messages
- 22
Hello
I have a db table that contains 6 columns
I am trying to build an update query from the table
The first time strSQL runs, the data would be inserted into field(1)
The next time it would be inserted into field(2) etc...
When it runs, I get an error saying there is no destination field in Insert Into statement (tbldrawings.fields(1))
Is this possible?
I need to run through this statement many times and append the value from it to the next field on the same record.
The reason I need to do this is because When I create the append query and run it in Access, I get no grouping; so I end up with 2000 records instead of 100 (or so). So I figure if I run through the SQL statement for each field, I can append the value to the field. Im not sure if I can append to the same record or not; maybe someone can answer that for me as well.
Thank you
Terry
I have a db table that contains 6 columns
I am trying to build an update query from the table
The first time strSQL runs, the data would be inserted into field(1)
The next time it would be inserted into field(2) etc...
When it runs, I get an error saying there is no destination field in Insert Into statement (tbldrawings.fields(1))
Code:
For x = 1 To 100
DoCmd.SetWarnings False
For H = 1 To 6 'field 0 is an ID field that I don't need to display
strSQL = "Insert into tblrandnumbers Select Count(*) as Cnt, tblrandnumbers.fields(" & H & ")"
strSQL = strSQL & " From tbldrawings "
strSQL = strSQL & "Group by tabledefs.tbldrawings.fields(" & H & ") "
strSQL = strSQL & "Having ((tbldrawings.tabledefs.fields(" & H & ")"
DoCmd.RunSQL strSQL
Next H
Next x
Is this possible?
I need to run through this statement many times and append the value from it to the next field on the same record.
The reason I need to do this is because When I create the append query and run it in Access, I get no grouping; so I end up with 2000 records instead of 100 (or so). So I figure if I run through the SQL statement for each field, I can append the value to the field. Im not sure if I can append to the same record or not; maybe someone can answer that for me as well.
Thank you
Terry