export the search results in the subform to an excel spreadsheet.

  • Thread starter harrykp via AccessMonster.com
  • Start date
H

harrykp via AccessMonster.com

And I am using this search code to display the search results in the subform:

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String

strWhere = "1=1"

' If status
If Nz(Me.status) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "writing_project.status = '" & Me.
status & "'"
End If


' If class
If Nz(Me.class) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "writing_project.class = '" & Me.
class & "'"
End If



If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "frm_edit_records_datasheet_subform", acFormDS, ,
strWhere, acFormEdit, acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.frm_edit_records_datasheet_subform.Form.Filter = strWhere
Me.frm_edit_records_datasheet_subform.Form.FilterOn = True
End If
End Sub
I need the export the search results in the subform to an excel spreadsheet.
Any ideas will be very much appreciated. Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top