Hi Guys,

I have a database with nearly 50,000 records in including sub forms that are connected to the main form, what I want to be able to do is, have a button on my switchboard that when clicked with export any records over 6 months into an Excel Spread Sheet. Is this possible at all and if so, How do I do it.

I only have basic knowlege of access so simple explanation is needed, sorry xx

I found this code, can anyone tell me if it is the correct one to use, I also need to know how to create the query for the button, I can do basic queries but I need the button to on export anything that is 6 months +.

Public Sub ModifyExportedExcelFileFormats(sFile As String)
On Error GoTo Err_ModifyExportedExcelFileFormats
Call ModifyExportedExcelFileFormats("X:\file.xls")

Application.SetOption "Show Status Bar", True

vStatusBar = SysCmd(acSysCmdSetStatus, "Formatting exported files... please wait.")

Dim xlApp As Object
Dim xlSheet As Object

Set xlApp = CreateObject("Excel.Application")
Set xlSheet = xlApp.Workbooks.Open(sFile).Sheets(1)

With xlApp
.Application.Sheets("DTDs Export data Archive").Select
.Application.Cells.Select
.Application.Selection.ClearFormats
.Application.Rows("1:1").Select
.Application.Selection.Font.Bold = True
.Application.Cells.Select
.Application.Selection.RowHeight = 12.75
.Application.Selection.Columns.AutoFit
.Application.Range("A2").Select
.Application.ActiveWindow.FreezePanes = True
.Application.Range("A1").Select
.Application.Selection.AutoFilter
End If
.Application.ActiveWorkbook.Save
.Application.ActiveWorkbook.Close
.Quit
End With

Set xlApp = Nothing
Set xlSheet = Nothing

vStatusBar = SysCmd(acSysCmdClearStatus)

Exit_ModifyExportedExcelFileFormats:
Exit Sub

Err_ModifyExportedExcelFileFormats:
vStatusBar = SysCmd(acSysCmdClearStatus)
MsgBox Err.Number & " - " & Err.Description
Resume Exit_ModifyExportedExcelFileFormats
End Sub
I would appricate someones help, you may need to be patient with me lol

Shaxx
xx