F
Fred Bloggs
I've created a simple form to locate members of a database by town, surname
or postcode. I've used Microsoft's Query by Form suggestion, so I have three
unbound text boxes, [BySname], [ByTown] and [ByPCode]. Then I've used a
command button to run a macro which runs the Query which has as its criteria
in the three relevant fields [Forms]![testform]![BySname]or
[Forms]![testform]![BySname]Is Null, etc.
What I want to do is to be able to clear all three fields rather than having
to use the text tool to highlight then delete the contents of the text boxes
on the form. I've tried creating a command button using the wizard's
'refresh' option, and also building an event which says:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
Me.Filter = ""
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, acFilterByForm,
acMenuVer70
Exit_Command11_Click:
Exit Sub
Err_Command11_Click:
MsgBox Err.Description
Resume Exit_Command11_Click
End Sub
which I found in one of the forums, but in both cases, if I click the button
a message comes up that says: The command or action 'refresh' isn't
available now.
I'm sure clearing fields on a query by form should be simple, but as a
newbie, and not knowing VBA, I can't figure it out, so your help would be
much appreciated.
Cheers
James
or postcode. I've used Microsoft's Query by Form suggestion, so I have three
unbound text boxes, [BySname], [ByTown] and [ByPCode]. Then I've used a
command button to run a macro which runs the Query which has as its criteria
in the three relevant fields [Forms]![testform]![BySname]or
[Forms]![testform]![BySname]Is Null, etc.
What I want to do is to be able to clear all three fields rather than having
to use the text tool to highlight then delete the contents of the text boxes
on the form. I've tried creating a command button using the wizard's
'refresh' option, and also building an event which says:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
Me.Filter = ""
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, acFilterByForm,
acMenuVer70
Exit_Command11_Click:
Exit Sub
Err_Command11_Click:
MsgBox Err.Description
Resume Exit_Command11_Click
End Sub
which I found in one of the forums, but in both cases, if I click the button
a message comes up that says: The command or action 'refresh' isn't
available now.
I'm sure clearing fields on a query by form should be simple, but as a
newbie, and not knowing VBA, I can't figure it out, so your help would be
much appreciated.
Cheers
James