Switch from Rows to Columns

S

saschamps9903

Hello,

I have a SUMIIF query that counts up several columns of information and
displays in one row of a query. What I would like to do now is be able to
display the top 3 columns into a report. Here is an example of what I have
now:

Month Funded Issue 1 Issue 2 Issue 3 Issue 4 Issue
5 Issue 6
December 2005 5 10 3 1
0 7

I want to be able to show the report, with the top 3 issues only:

Issues Month Funded

Issue 2 10
Issue 6 7
Issue 5 5

I tried a Union Query suggestion dated 06/20/2005 but this did not work.
Also, tried to send the query to excel and use the paste-special feature to
flip the columns and rows and send the table back to access. this works, but
is time consuming and will not be able to be as automated as I would like.
Does anyone have any suggestions? thanks
 
D

Duane Hookom

You stated "but this did not work" and I am fairly confident that it would
work. Can you describe your UNION query sql and why you think "but this did
not work"?
 
S

saschamps9903

oops, my mistake. What i am trying to do is switch from COLUMNS to ROWS,
sorry for the error.
 
S

saschamps9903

What i tried to do was run the union query and i got the following error
message:

"Syntax error (missing operator) in query expression "total A-Hud1 Issues"

Coincidentally, I just saw a similar question posted 1/5/2005 where you
described how to run the union query but also create a crosstab query from
the union query. If i do this, will i get the same error? I did not create
the crosstab query because i kept getting the aforementioned error.
 
J

John Vinson

"Syntax error (missing operator) in query expression "total A-Hud1 Issues"

This probably means you have a field, or a table, named A-Hudl Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing, and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
D

Duane Hookom

I second that observation...

--
Duane Hookom
MS Access MVP
--

John Vinson said:
"Syntax error (missing operator) in query expression "total A-Hud1 Issues"

This probably means you have a field, or a table, named A-Hudl Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing, and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
S

saschamps9903

I will try that, thanks for the help. Will let you guys know what happens

Duane Hookom said:
I second that observation...

--
Duane Hookom
MS Access MVP
--

John Vinson said:
"Syntax error (missing operator) in query expression "total A-Hud1 Issues"

This probably means you have a field, or a table, named A-Hudl Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing, and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
S

saschamps9903

ok, i tried it and it did not work. what the union query does is give me the
information I want but in only one column. in essence, the information is
transferred to one column instead of rows like i need it to be.

I found this sample code that I am trying to use in a module that is
supposed to transpose column to row, but I am getting errors also as it is
not referencing the 1st line of code. here is the code referenced from
article 182882 from the microsoft website.
http://support.microsoft.com/kb/182822/en-us

Function Transposer(strSource As String, strTarget As String)

Dim db As Database
Dim tdfNewDef As TableDef
Dim fldNewField As Field
Dim rstSource As Recordset, rstTarget As Recordset
Dim i As Integer, j As Integer

On Error GoTo Transposer_Err

Set db = CurrentDb()
Set rstSource = db.OpenRecordset(strSource)
rstSource.MoveLast

' Create a new table to hold the transposed data.
' Create a field for each record in the original table.
Set tdfNewDef = db.CreateTableDef(strTarget)
For i = 0 To rstSource.RecordCount
Set fldNewField = tdfNewDef.CreateField(CStr(i + 1), dbText)
tdfNewDef.Fields.Append fldNewField
Next i
db.TableDefs.Append tdfNewDef

' Open the new table and fill the first field with
' field names from the original table.
Set rstTarget = db.OpenRecordset(strTarget)
For i = 0 To rstSource.Fields.Count - 1
With rstTarget
.AddNew
.Fields(0) = rstSource.Fields(i).Name
.Update
End With
Next i

rstSource.MoveFirst
rstTarget.MoveFirst
' Fill each column of the new table
' with a record from the original table.
For j = 0 To rstSource.Fields.Count - 1
' Begin with the second field, because the first field
' already contains the field names.
For i = 1 To rstTarget.Fields.Count - 1
With rstTarget
.Edit
.Fields(i) = rstSource.Fields(j)
rstSource.MoveNext
.Update
End With

Next i
rstSource.MoveFirst
rstTarget.MoveNext
Next j

db.Close

Exit Function

Transposer_Err:

Select Case Err
Case 3010
MsgBox "The table " & strTarget & " already exists."
Case 3078
MsgBox "The table " & strSource & " doesn't exist."
Case Else
MsgBox CStr(Err) & " " & Err.Description
End Select

Exit Function

End Function


saschamps9903 said:
I will try that, thanks for the help. Will let you guys know what happens

Duane Hookom said:
I second that observation...

--
Duane Hookom
MS Access MVP
--

John Vinson said:
On Wed, 4 Jan 2006 14:16:03 -0800, "saschamps9903"

"Syntax error (missing operator) in query expression "total A-Hud1 Issues"


This probably means you have a field, or a table, named A-Hudl Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing, and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
D

Duane Hookom

I assume your union query will properly normalize your table. Now, you
should be able to create a Crosstab query based on your union query. Can you
provide the SQL of your union query, a few sample records from the union
query, and how you want these to finally appear?

--
Duane Hookom
MS Access MVP
--

saschamps9903 said:
ok, i tried it and it did not work. what the union query does is give me
the
information I want but in only one column. in essence, the information is
transferred to one column instead of rows like i need it to be.

I found this sample code that I am trying to use in a module that is
supposed to transpose column to row, but I am getting errors also as it is
not referencing the 1st line of code. here is the code referenced from
article 182882 from the microsoft website.
http://support.microsoft.com/kb/182822/en-us

Function Transposer(strSource As String, strTarget As String)

Dim db As Database
Dim tdfNewDef As TableDef
Dim fldNewField As Field
Dim rstSource As Recordset, rstTarget As Recordset
Dim i As Integer, j As Integer

On Error GoTo Transposer_Err

Set db = CurrentDb()
Set rstSource = db.OpenRecordset(strSource)
rstSource.MoveLast

' Create a new table to hold the transposed data.
' Create a field for each record in the original table.
Set tdfNewDef = db.CreateTableDef(strTarget)
For i = 0 To rstSource.RecordCount
Set fldNewField = tdfNewDef.CreateField(CStr(i + 1), dbText)
tdfNewDef.Fields.Append fldNewField
Next i
db.TableDefs.Append tdfNewDef

' Open the new table and fill the first field with
' field names from the original table.
Set rstTarget = db.OpenRecordset(strTarget)
For i = 0 To rstSource.Fields.Count - 1
With rstTarget
.AddNew
.Fields(0) = rstSource.Fields(i).Name
.Update
End With
Next i

rstSource.MoveFirst
rstTarget.MoveFirst
' Fill each column of the new table
' with a record from the original table.
For j = 0 To rstSource.Fields.Count - 1
' Begin with the second field, because the first field
' already contains the field names.
For i = 1 To rstTarget.Fields.Count - 1
With rstTarget
.Edit
.Fields(i) = rstSource.Fields(j)
rstSource.MoveNext
.Update
End With

Next i
rstSource.MoveFirst
rstTarget.MoveNext
Next j

db.Close

Exit Function

Transposer_Err:

Select Case Err
Case 3010
MsgBox "The table " & strTarget & " already exists."
Case 3078
MsgBox "The table " & strSource & " doesn't exist."
Case Else
MsgBox CStr(Err) & " " & Err.Description
End Select

Exit Function

End Function


saschamps9903 said:
I will try that, thanks for the help. Will let you guys know what
happens

Duane Hookom said:
I second that observation...

--
Duane Hookom
MS Access MVP
--

On Wed, 4 Jan 2006 14:16:03 -0800, "saschamps9903"

"Syntax error (missing operator) in query expression "total A-Hud1
Issues"


This probably means you have a field, or a table, named A-Hudl Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing,
and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
S

saschamps9903

Here is a sample of the union query. I am trying to take the columns and row
and transpose. The information for this union query comes from a sub (or
nested) SUM IIF query, where only one row of data is present and not from a
table (could this be the issue?). This has not worked because the error
message regarding missing operand occurs. when I place the brackets around
each of the field names and run the query, all that data appears in one
column named for the first field at the top of the sql statement (Total
SectionA Issues).

example:

Total SectionA Issues
5
4
3
etc...

I want the names of each field to reside in one column, with their
corresponding data appearing right next to the name of the field.

so instead of the data appearing as in the example below:

Month Total SectionA Issues Total SectionB Issues Total
Section C Iss
Dec 2005 5 4
3

I would like to have the data appear like this:

Issue Fields Dec 2005
Total SectionA Issues 5
Total SectionB Issues 4
Total SectionC Issues 3

and so on...

Duane Hookom said:
I assume your union query will properly normalize your table. Now, you
should be able to create a Crosstab query based on your union query. Can you
provide the SQL of your union query, a few sample records from the union
query, and how you want these to finally appear?

--
Duane Hookom
MS Access MVP
--

saschamps9903 said:
ok, i tried it and it did not work. what the union query does is give me
the
information I want but in only one column. in essence, the information is
transferred to one column instead of rows like i need it to be.

I found this sample code that I am trying to use in a module that is
supposed to transpose column to row, but I am getting errors also as it is
not referencing the 1st line of code. here is the code referenced from
article 182882 from the microsoft website.
http://support.microsoft.com/kb/182822/en-us

Function Transposer(strSource As String, strTarget As String)

Dim db As Database
Dim tdfNewDef As TableDef
Dim fldNewField As Field
Dim rstSource As Recordset, rstTarget As Recordset
Dim i As Integer, j As Integer

On Error GoTo Transposer_Err

Set db = CurrentDb()
Set rstSource = db.OpenRecordset(strSource)
rstSource.MoveLast

' Create a new table to hold the transposed data.
' Create a field for each record in the original table.
Set tdfNewDef = db.CreateTableDef(strTarget)
For i = 0 To rstSource.RecordCount
Set fldNewField = tdfNewDef.CreateField(CStr(i + 1), dbText)
tdfNewDef.Fields.Append fldNewField
Next i
db.TableDefs.Append tdfNewDef

' Open the new table and fill the first field with
' field names from the original table.
Set rstTarget = db.OpenRecordset(strTarget)
For i = 0 To rstSource.Fields.Count - 1
With rstTarget
.AddNew
.Fields(0) = rstSource.Fields(i).Name
.Update
End With
Next i

rstSource.MoveFirst
rstTarget.MoveFirst
' Fill each column of the new table
' with a record from the original table.
For j = 0 To rstSource.Fields.Count - 1
' Begin with the second field, because the first field
' already contains the field names.
For i = 1 To rstTarget.Fields.Count - 1
With rstTarget
.Edit
.Fields(i) = rstSource.Fields(j)
rstSource.MoveNext
.Update
End With

Next i
rstSource.MoveFirst
rstTarget.MoveNext
Next j

db.Close

Exit Function

Transposer_Err:

Select Case Err
Case 3010
MsgBox "The table " & strTarget & " already exists."
Case 3078
MsgBox "The table " & strSource & " doesn't exist."
Case Else
MsgBox CStr(Err) & " " & Err.Description
End Select

Exit Function

End Function


saschamps9903 said:
I will try that, thanks for the help. Will let you guys know what
happens

:

I second that observation...

--
Duane Hookom
MS Access MVP
--

On Wed, 4 Jan 2006 14:16:03 -0800, "saschamps9903"

"Syntax error (missing operator) in query expression "total A-Hud1
Issues"


This probably means you have a field, or a table, named A-Hudl Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing,
and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
D

Duane Hookom

Can you describe and provide an example of your RAW DATA? Then, how you
would want THIS RAW DATA to appear in its final form.

--
Duane Hookom
MS Access MVP
--

saschamps9903 said:
Here is a sample of the union query. I am trying to take the columns and
row
and transpose. The information for this union query comes from a sub (or
nested) SUM IIF query, where only one row of data is present and not from
a
table (could this be the issue?). This has not worked because the error
message regarding missing operand occurs. when I place the brackets
around
each of the field names and run the query, all that data appears in one
column named for the first field at the top of the sql statement (Total
SectionA Issues).

example:

Total SectionA Issues
5
4
3
etc...

I want the names of each field to reside in one column, with their
corresponding data appearing right next to the name of the field.

so instead of the data appearing as in the example below:

Month Total SectionA Issues Total SectionB Issues Total
Section C Iss
Dec 2005 5 4
3

I would like to have the data appear like this:

Issue Fields Dec 2005
Total SectionA Issues 5
Total SectionB Issues 4
Total SectionC Issues 3

and so on...

Duane Hookom said:
I assume your union query will properly normalize your table. Now, you
should be able to create a Crosstab query based on your union query. Can
you
provide the SQL of your union query, a few sample records from the union
query, and how you want these to finally appear?

--
Duane Hookom
MS Access MVP
--

message
ok, i tried it and it did not work. what the union query does is give
me
the
information I want but in only one column. in essence, the information
is
transferred to one column instead of rows like i need it to be.

I found this sample code that I am trying to use in a module that is
supposed to transpose column to row, but I am getting errors also as it
is
not referencing the 1st line of code. here is the code referenced from
article 182882 from the microsoft website.
http://support.microsoft.com/kb/182822/en-us

Function Transposer(strSource As String, strTarget As String)

Dim db As Database
Dim tdfNewDef As TableDef
Dim fldNewField As Field
Dim rstSource As Recordset, rstTarget As Recordset
Dim i As Integer, j As Integer

On Error GoTo Transposer_Err

Set db = CurrentDb()
Set rstSource = db.OpenRecordset(strSource)
rstSource.MoveLast

' Create a new table to hold the transposed data.
' Create a field for each record in the original table.
Set tdfNewDef = db.CreateTableDef(strTarget)
For i = 0 To rstSource.RecordCount
Set fldNewField = tdfNewDef.CreateField(CStr(i + 1), dbText)
tdfNewDef.Fields.Append fldNewField
Next i
db.TableDefs.Append tdfNewDef

' Open the new table and fill the first field with
' field names from the original table.
Set rstTarget = db.OpenRecordset(strTarget)
For i = 0 To rstSource.Fields.Count - 1
With rstTarget
.AddNew
.Fields(0) = rstSource.Fields(i).Name
.Update
End With
Next i

rstSource.MoveFirst
rstTarget.MoveFirst
' Fill each column of the new table
' with a record from the original table.
For j = 0 To rstSource.Fields.Count - 1
' Begin with the second field, because the first field
' already contains the field names.
For i = 1 To rstTarget.Fields.Count - 1
With rstTarget
.Edit
.Fields(i) = rstSource.Fields(j)
rstSource.MoveNext
.Update
End With

Next i
rstSource.MoveFirst
rstTarget.MoveNext
Next j

db.Close

Exit Function

Transposer_Err:

Select Case Err
Case 3010
MsgBox "The table " & strTarget & " already exists."
Case 3078
MsgBox "The table " & strSource & " doesn't exist."
Case Else
MsgBox CStr(Err) & " " & Err.Description
End Select

Exit Function

End Function


:

I will try that, thanks for the help. Will let you guys know what
happens

:

I second that observation...

--
Duane Hookom
MS Access MVP
--

On Wed, 4 Jan 2006 14:16:03 -0800, "saschamps9903"

"Syntax error (missing operator) in query expression "total A-Hud1
Issues"


This probably means you have a field, or a table, named A-Hudl
Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing,
and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
S

saschamps9903

What I described is pretty much what the query generates and the data I am
looking to place in a report. one row, 13 columns. the example data below
is pretty much what this query does. the SUM IIF query adds up the
checkboxes within each of the columns and then displays the data in one row.

Duane Hookom said:
Can you describe and provide an example of your RAW DATA? Then, how you
would want THIS RAW DATA to appear in its final form.

--
Duane Hookom
MS Access MVP
--

saschamps9903 said:
Here is a sample of the union query. I am trying to take the columns and
row
and transpose. The information for this union query comes from a sub (or
nested) SUM IIF query, where only one row of data is present and not from
a
table (could this be the issue?). This has not worked because the error
message regarding missing operand occurs. when I place the brackets
around
each of the field names and run the query, all that data appears in one
column named for the first field at the top of the sql statement (Total
SectionA Issues).

example:

Total SectionA Issues
5
4
3
etc...

I want the names of each field to reside in one column, with their
corresponding data appearing right next to the name of the field.

so instead of the data appearing as in the example below:

Month Total SectionA Issues Total SectionB Issues Total
Section C Iss
Dec 2005 5 4
3

I would like to have the data appear like this:

Issue Fields Dec 2005
Total SectionA Issues 5
Total SectionB Issues 4
Total SectionC Issues 3

and so on...

Duane Hookom said:
I assume your union query will properly normalize your table. Now, you
should be able to create a Crosstab query based on your union query. Can
you
provide the SQL of your union query, a few sample records from the union
query, and how you want these to finally appear?

--
Duane Hookom
MS Access MVP
--

message
ok, i tried it and it did not work. what the union query does is give
me
the
information I want but in only one column. in essence, the information
is
transferred to one column instead of rows like i need it to be.

I found this sample code that I am trying to use in a module that is
supposed to transpose column to row, but I am getting errors also as it
is
not referencing the 1st line of code. here is the code referenced from
article 182882 from the microsoft website.
http://support.microsoft.com/kb/182822/en-us

Function Transposer(strSource As String, strTarget As String)

Dim db As Database
Dim tdfNewDef As TableDef
Dim fldNewField As Field
Dim rstSource As Recordset, rstTarget As Recordset
Dim i As Integer, j As Integer

On Error GoTo Transposer_Err

Set db = CurrentDb()
Set rstSource = db.OpenRecordset(strSource)
rstSource.MoveLast

' Create a new table to hold the transposed data.
' Create a field for each record in the original table.
Set tdfNewDef = db.CreateTableDef(strTarget)
For i = 0 To rstSource.RecordCount
Set fldNewField = tdfNewDef.CreateField(CStr(i + 1), dbText)
tdfNewDef.Fields.Append fldNewField
Next i
db.TableDefs.Append tdfNewDef

' Open the new table and fill the first field with
' field names from the original table.
Set rstTarget = db.OpenRecordset(strTarget)
For i = 0 To rstSource.Fields.Count - 1
With rstTarget
.AddNew
.Fields(0) = rstSource.Fields(i).Name
.Update
End With
Next i

rstSource.MoveFirst
rstTarget.MoveFirst
' Fill each column of the new table
' with a record from the original table.
For j = 0 To rstSource.Fields.Count - 1
' Begin with the second field, because the first field
' already contains the field names.
For i = 1 To rstTarget.Fields.Count - 1
With rstTarget
.Edit
.Fields(i) = rstSource.Fields(j)
rstSource.MoveNext
.Update
End With

Next i
rstSource.MoveFirst
rstTarget.MoveNext
Next j

db.Close

Exit Function

Transposer_Err:

Select Case Err
Case 3010
MsgBox "The table " & strTarget & " already exists."
Case 3078
MsgBox "The table " & strSource & " doesn't exist."
Case Else
MsgBox CStr(Err) & " " & Err.Description
End Select

Exit Function

End Function


:

I will try that, thanks for the help. Will let you guys know what
happens

:

I second that observation...

--
Duane Hookom
MS Access MVP
--

On Wed, 4 Jan 2006 14:16:03 -0800, "saschamps9903"

"Syntax error (missing operator) in query expression "total A-Hud1
Issues"


This probably means you have a field, or a table, named A-Hudl
Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in [Square
brackets] - otherwise Access will assume that A-Hudl is one thing,
and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 
D

Duane Hookom

I'm concerned that you want to go from Point A to Point D. You have allready
figured out how to get from Point H and asked how to get from Point H to
Point D. I am wondering if it would be much easier to get from Point A to
Point D than going from Point A to Point H to Point D.

That is why I am asking where Point A is and Point D is. I think you have
described Point D as:
==== Point D ===============
I want to be able to show the report, with the top 3 issues only:
Issues Month Funded
Issue 2 10
Issue 6 7
Issue 5 5
==========================

I don't necessarily care where Point H is right now since I don't want to
waste resources getting you from Point H to Point D when Point H may not be
the best place to travel through.

--
Duane Hookom
MS Access MVP
--

saschamps9903 said:
What I described is pretty much what the query generates and the data I am
looking to place in a report. one row, 13 columns. the example data
below
is pretty much what this query does. the SUM IIF query adds up the
checkboxes within each of the columns and then displays the data in one
row.

Duane Hookom said:
Can you describe and provide an example of your RAW DATA? Then, how you
would want THIS RAW DATA to appear in its final form.

--
Duane Hookom
MS Access MVP
--

message
Here is a sample of the union query. I am trying to take the columns
and
row
and transpose. The information for this union query comes from a sub
(or
nested) SUM IIF query, where only one row of data is present and not
from
a
table (could this be the issue?). This has not worked because the
error
message regarding missing operand occurs. when I place the brackets
around
each of the field names and run the query, all that data appears in one
column named for the first field at the top of the sql statement (Total
SectionA Issues).

example:

Total SectionA Issues
5
4
3
etc...

I want the names of each field to reside in one column, with their
corresponding data appearing right next to the name of the field.

so instead of the data appearing as in the example below:

Month Total SectionA Issues Total SectionB Issues Total
Section C Iss
Dec 2005 5 4
3

I would like to have the data appear like this:

Issue Fields Dec 2005
Total SectionA Issues 5
Total SectionB Issues 4
Total SectionC Issues 3

and so on...

:

I assume your union query will properly normalize your table. Now, you
should be able to create a Crosstab query based on your union query.
Can
you
provide the SQL of your union query, a few sample records from the
union
query, and how you want these to finally appear?

--
Duane Hookom
MS Access MVP
--

message
ok, i tried it and it did not work. what the union query does is
give
me
the
information I want but in only one column. in essence, the
information
is
transferred to one column instead of rows like i need it to be.

I found this sample code that I am trying to use in a module that is
supposed to transpose column to row, but I am getting errors also as
it
is
not referencing the 1st line of code. here is the code referenced
from
article 182882 from the microsoft website.
http://support.microsoft.com/kb/182822/en-us

Function Transposer(strSource As String, strTarget As String)

Dim db As Database
Dim tdfNewDef As TableDef
Dim fldNewField As Field
Dim rstSource As Recordset, rstTarget As Recordset
Dim i As Integer, j As Integer

On Error GoTo Transposer_Err

Set db = CurrentDb()
Set rstSource = db.OpenRecordset(strSource)
rstSource.MoveLast

' Create a new table to hold the transposed data.
' Create a field for each record in the original table.
Set tdfNewDef = db.CreateTableDef(strTarget)
For i = 0 To rstSource.RecordCount
Set fldNewField = tdfNewDef.CreateField(CStr(i + 1),
dbText)
tdfNewDef.Fields.Append fldNewField
Next i
db.TableDefs.Append tdfNewDef

' Open the new table and fill the first field with
' field names from the original table.
Set rstTarget = db.OpenRecordset(strTarget)
For i = 0 To rstSource.Fields.Count - 1
With rstTarget
.AddNew
.Fields(0) = rstSource.Fields(i).Name
.Update
End With
Next i

rstSource.MoveFirst
rstTarget.MoveFirst
' Fill each column of the new table
' with a record from the original table.
For j = 0 To rstSource.Fields.Count - 1
' Begin with the second field, because the first field
' already contains the field names.
For i = 1 To rstTarget.Fields.Count - 1
With rstTarget
.Edit
.Fields(i) = rstSource.Fields(j)
rstSource.MoveNext
.Update
End With

Next i
rstSource.MoveFirst
rstTarget.MoveNext
Next j

db.Close

Exit Function

Transposer_Err:

Select Case Err
Case 3010
MsgBox "The table " & strTarget & " already exists."
Case 3078
MsgBox "The table " & strSource & " doesn't exist."
Case Else
MsgBox CStr(Err) & " " & Err.Description
End Select

Exit Function

End Function


:

I will try that, thanks for the help. Will let you guys know what
happens

:

I second that observation...

--
Duane Hookom
MS Access MVP
--

message
On Wed, 4 Jan 2006 14:16:03 -0800, "saschamps9903"

"Syntax error (missing operator) in query expression "total
A-Hud1
Issues"


This probably means you have a field, or a table, named A-Hudl
Issues
(or some other name containing blanks or special characters).

Enclose all of your table and fieldnames in the query in
[Square
brackets] - otherwise Access will assume that A-Hudl is one
thing,
and
Issues is some different thing, and thereby get confused.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top