Hi AccessForum community,
I have a Access 2010 multi value combo box trying to export the values selected to a excel spreadsheet. Reading microsoft url: http://office.microsoft.com/en-us/ac...001233722.aspx. If you use in criteria for example: tablename.fieldname(selected items location) it should show all the selected items on one row. That does not work. When I try to export to excel it shows only two letters. For example if November, December, March was selected the only thing that show is No(for November) . If I put the other option tablename.fieldname.value. It works as advertised. It put each month on a different row. I looked all over to try to figure why it is stoping after 2 letters. If I run a query the selected items are showing up complete. here is my code: I probably need some code for multi value occurrences but not sure how to. I am a novice user of Access. thanks in advance.................
Dim oRS As DAO.Recordset, i As Long, sformat As String
Dim oExc As Excel.Application
Dim oWB As Excel.Workbook, oWS As Excel.Worksheet
With CurrentDb.QueryDefs("AllIDNumberLastNameFirstNameB irthdateq")
For i = 0 To .Parameters.Count - 1
.Parameters(i).Value = InputBox("Set parameter: " & .Parameters(i).Name)
Next i
Set oRS = .OpenRecordset
If oRS.RecordCount = 0 Then MsgBox "No records": Exit Sub
End With
Set oExc = CreateObject("Excel.Application")
Set oWB = oExc.Workbooks.Add
Set oWS = oWB.Sheets(1)
'oWS.Name = Me.Combo2.Value
For i = 0 To oRS.Fields.Count - 1
oWS.Cells(1, i + 1) = oRS.Fields(i).Name
Select Case oRS.Fields(i).Type
Case dbDate: sformat = "mm/dd/yyy"
Case dbCurrency: sformat = "$#,##0.00"
End Select
oWS.Cells(1, i + 1).EntireColumn.NumberFormat = sformat
Next i
oWS.Cells(2, 1).CopyFromRecordset oRS
oWS.Cells.EntireColumn.AutoFit: oWS.Cells.EntireRow.AutoFit
oExc.Visible = True
oWS.Cells(1, 1).EntireRow.Font.Bold = True
oWS.Cells(1, 1).EntireRow.Font.Italic = True