Solved Export from Ms Access form in to Excel

skdn71

New member
Local time
Today, 03:44
Joined
Jul 23, 2023
Messages
25
Hello,

Could you please help how to exporting search results in to xlsx file, with below vba i get empty result on excel

see attachement
Code:
Private Sub Command91_Click()
DoCmd.OutputTo acOutputForm, "Listproduct", acFormatXLSX, "C:\Data\export.xlsx", True
End Sub

Private Sub txtSearch_KeyUp(KeyCode As Integer, Shift As Integer)
    Me.frmlistprod.Form.Filter = "[ItemCode]Like '*" & Me.txtSearch.Text & "*' or" _
    & "[ItemDescription]Like '*" & Me.txtSearch.Text & "*' or" _
    & "[PPU]Like '*" & Me.txtSearch.Text & "*'"
    Me.frmlistprod.Form.FilterOn = True
End Sub
 

Attachments

  • Result export.jpg
    Result export.jpg
    80.7 KB · Views: 84
  • Product.jpg
    Product.jpg
    104.8 KB · Views: 81
  • form.jpg
    form.jpg
    112.5 KB · Views: 83
  • Product.accdb
    Product.accdb
    4.2 MB · Views: 91
Check out Excel automation and the CopyFromRecordset method.
 
First you need to turn your filter into a query and then you can use B tab development code here:-


I also have several blogs demonstrating the above code on my website:-

 
Look at TransferSpreadSheet perhaps?
 
here try your export form.
 

Attachments

Users who are viewing this thread

Back
Top Bottom