Open in datasheet view

M

Melissa

Is there a way to open the results from the filter in datasheet view or any
view that allows me to copy the results? I have an email address field and
need to be able to quickly copy them from the filter results. I know I can
change it from Form to Datasheet view once I run the filter but I am looking
for a better solution, if one exists.

Here's the code I am using:


Private Sub cmdFilter_Click()

If Not IsNull(Me.txtFilterRegion) Then
strWhere = strWhere & "([Region] = """ & Me.txtFilterRegion & """)
AND "
End If

If Not IsNull(Me.txtFilterState) Then
strWhere = strWhere & "([MarketState] = """ & Me.txtFilterState &
""") AND "
End If


If Not IsNull(Me.TxtFilterCategory) Then
strWhere = strWhere & "([Category] = """ & Me.TxtFilterCategory &
""") AND "
End If


If Not IsNull(Me.txtFilterShipTo) Then
strWhere = strWhere & "([Ship To] Like ""*" & Me.txtFilterShipTo &
"*"") AND "
End If

lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)



Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub

Private Sub cmdReset_Click()

Dim ctl As Control



For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next


Me.FilterOn = False
End Sub

Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "You cannot add new clients to the search form.", vbInformation,
"Permission denied."
End Sub

Private Sub Form_Open(Cancel As Integer)
'Me.Filter = "(False)"
'Me.FilterOn = True
End Sub


Melissa
 

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