M
Maggie May
I have the following code and I keep getting a 13 Type
Mismatch error when I get to the line "For Each fld In
rec.Fields" The "M" is a parameter which is defined in
qryXLRatesbyShipline_Crosstab (crosstab query). The
strShip is a string and field that is compared to the "M"
parameter is text. This is code from a different
programmer that I have inherited. It worked before and I
have been adding a form (completely unrelated to this)
and now cannot get it to work. I copied over all of the
queries and code involved with this, but it still does
not work. Please help!! Maggie
Dim db As Database
Dim rec As DAO.Recordset
Dim recf As DAO.Recordset
Dim qd As QueryDef
Dim fld As Field
Dim intcolumn As Integer
Dim intRow As Integer
Dim intTotalcolumn As Integer
Dim i As Integer
Set db = CurrentDb()
Set qd = db.QueryDefs("qryXLRatesbyShipline_Crosstab")
qd.Parameters("M") = strShip
Set rec = qd.OpenRecordset()
Set objWS = MyXL.Application.ActiveSheet
MyXL.Application.Worksheets(strSheet).Cells(1,
3).Value = UCase(rec.Fields(0))
intcolumn = 1
intRow = 2
For Each fld In rec.Fields
Mismatch error when I get to the line "For Each fld In
rec.Fields" The "M" is a parameter which is defined in
qryXLRatesbyShipline_Crosstab (crosstab query). The
strShip is a string and field that is compared to the "M"
parameter is text. This is code from a different
programmer that I have inherited. It worked before and I
have been adding a form (completely unrelated to this)
and now cannot get it to work. I copied over all of the
queries and code involved with this, but it still does
not work. Please help!! Maggie
Dim db As Database
Dim rec As DAO.Recordset
Dim recf As DAO.Recordset
Dim qd As QueryDef
Dim fld As Field
Dim intcolumn As Integer
Dim intRow As Integer
Dim intTotalcolumn As Integer
Dim i As Integer
Set db = CurrentDb()
Set qd = db.QueryDefs("qryXLRatesbyShipline_Crosstab")
qd.Parameters("M") = strShip
Set rec = qd.OpenRecordset()
Set objWS = MyXL.Application.ActiveSheet
MyXL.Application.Worksheets(strSheet).Cells(1,
3).Value = UCase(rec.Fields(0))
intcolumn = 1
intRow = 2
For Each fld In rec.Fields