Thread: macro help
View Single Post
  #2  
Old June 3rd, 2010, 08:58 PM posted to microsoft.public.access.gettingstarted
tighe
external usenet poster
 
Posts: 53
Default macro help

mick.

i have to admit i dont use the where condition(it might be where the quotes
are) but you could handle this On Load of the "customers input form" with vba:

Sub Form_Load()
If IsLoaded("[order form]") = True Then
me.filter="[CRN]=" & forms.[order form].[CRN] 'still might have to adjust
quotes
Me.filterOn=true
else: me.filteron=false
End If
end sub
make sure to turn filter on load to yes
"mick" wrote:

I have a "customers input form" for entering name, address, ref no.,
etc.
I have an "order form" with a text box into which can be manually
entered a customer reference number when needed. Next to the box is a
button that when activated opens the "customers input form" displaying
the customer details.
The macro for the button is:
OpenForm
form name, customers input
where condition, ="[CRN]=" & [CRN]

This works fine, except when the button is activated and there is
nothing in the text box, there is then a syntax error and the macro has
to be stopped manually.

Question is; what do I need to add to the macro to prevent the error
happening when the text box is empty and the button is activated?

Thanks.

--
mick


.