Does anyone know how to export the results of a recordset into an excel file, i know it may sound abit vague and alot of work but i honestly dont even know where to start the exporting...
heres the recordset code that originally fills a textbox with the recordset result...
Private Sub EnterDate_Click()
Dim strEuro As String
Dim VATQuerySet As DAO.Recordset
Dim SQL As String
strEuro = "€"
strSpace = " "
strMonth = Me.MonthCombo
intYear = Me.YearCombo
strEmployee = Me.EmployeeCombo
SQL = "SELECT BillingMonths.[Total Excluding VAT] " & _
"FROM SimsUpdate " & _
"INNER JOIN BillingMonths " & _
"ON SimsUpdate.GSM = BillingMonths.GSM " & _
"WHERE (BillingMonths.[Month] = '" & strMonth & "') AND " & _
"(BillingMonths.[Year] = " & intYear & ") AND " & _
"(SimsUpdate.[Employee Name] = '" & strEmployee & "')"
Set VATQuerySet = CurrentDb.OpenRecordset(SQL)
Me.TotalExcludingVATTextbox.SetFocus
If (Me.EnterDate.Enabled = True) Then
If VATQuerySet.EOF Or VATQuerySet.BOF Then
MsgBox "There is no available bill for " & vbCr & vbCr & strMonth & strSpace & intYear, vbOKOnly + vbInformation, "Date Error Occured:"
Me.TotalExcludingVATTextbox.Text = blankVar
Else
VATQuerySet.MoveFirst
Me.TotalExcludingVATTextbox.Enabled = True
Me.TotalExcludingVATTextbox.Text = strEuro + VATQuerySet.Fields(0)
End If
Me.EnterDate.SetFocus
End If
End Sub
heres the recordset code that originally fills a textbox with the recordset result...
Private Sub EnterDate_Click()
Dim strEuro As String
Dim VATQuerySet As DAO.Recordset
Dim SQL As String
strEuro = "€"
strSpace = " "
strMonth = Me.MonthCombo
intYear = Me.YearCombo
strEmployee = Me.EmployeeCombo
SQL = "SELECT BillingMonths.[Total Excluding VAT] " & _
"FROM SimsUpdate " & _
"INNER JOIN BillingMonths " & _
"ON SimsUpdate.GSM = BillingMonths.GSM " & _
"WHERE (BillingMonths.[Month] = '" & strMonth & "') AND " & _
"(BillingMonths.[Year] = " & intYear & ") AND " & _
"(SimsUpdate.[Employee Name] = '" & strEmployee & "')"
Set VATQuerySet = CurrentDb.OpenRecordset(SQL)
Me.TotalExcludingVATTextbox.SetFocus
If (Me.EnterDate.Enabled = True) Then
If VATQuerySet.EOF Or VATQuerySet.BOF Then
MsgBox "There is no available bill for " & vbCr & vbCr & strMonth & strSpace & intYear, vbOKOnly + vbInformation, "Date Error Occured:"
Me.TotalExcludingVATTextbox.Text = blankVar
Else
VATQuerySet.MoveFirst
Me.TotalExcludingVATTextbox.Enabled = True
Me.TotalExcludingVATTextbox.Text = strEuro + VATQuerySet.Fields(0)
End If
Me.EnterDate.SetFocus
End If
End Sub