I have a code that exports into an excel sheet. I have a good understanding how it is occurring. But now I want to add within the module that export of just one line.
This code selects data
Set rs = CurrentDb.OpenRecordset("SELECT Terms FROM Terms_Export WHERE Customer_Quote_Number='" & RFQNUM & "'") '
Then tells it where to paste it.
If rs.EOF = False And rs.BOF = False Then
rs.MoveFirst
If blnHeaderRow = True Then
For lngColumn = 0 To rs.Fields.Count - 1
xlc.Offset(0, lngColumn).Value = rs.Fields(lngColumn).Name
Next lngColumn
Set xlc = xlc.Offset(1, 0)
End If
' write data to worksheet
Do While rs.EOF = False
For lngColumn = 0 To rs.Fields.Count - 1
xlc.Offset(0, lngColumn).Value = rs.Fields(lngColumn).Value
Next lngColumn
rs.MoveNext
Set xlc = xlc.Offset(1, 0)
Loop
End If
rs.Close
Set rs = Nothing
This works great. The result is...it is entered across (based on the number of fields that is "selected") and down. I want to change this to just down. The result of the query is just one line, and I want the four fields (across) to be exported into excel straight down.