code doesn't work on other computers

X

xlcharlie

I've written the code at bottom to open certain forms in my db. It all works
fine on my computer, where I created the db. But when users at other
stations use the database, the click event that should execute the code
doesn't seem to do anything. Do I need to specify the database? Is there
something in their settings that needs to be changed? I'm not using the
Security feature. HELP PLEASE!


subject = Forms!frm_Search!txtSubject.Text
category = Forms!frm_Search!cmbCategory.Text
DoCmd.OpenForm FormName:="frm_Browse", view:=acNormal,
wherecondition:= category & " Like " & Chr$(34) & "*" & subject & "*" &
Chr$(34)
 
J

John Spencer (MVP)

Are you sure that this works the way you expect.

The text property is only accessible for a control when the control has the
focus. At least in the versions of Access that I've worked with.

.value is not really required since that is the default property of a control

subject = Forms!frm_Search!txtSubject.Value
category = Forms!frm_Search!cmbCategory.Value
DoCmd.OpenForm FormName:="frm_Browse", view:=acNormal, _
wherecondition:= category & " Like " & _
Chr$(34) & "*" & subject & "*" & Chr$(34)

Note that I've used the line continuation character to continue the line of code.
 
X

xlcharlie

Thanks for your reply. The code does work properly by moving the focus, but
you're right, using .Value is a better choice. Nevertheless, my original
probelm remains. The click event for the form doesn't work on every machine,
and I'm stumped as to why. I use the click event with DoCmd.OpenForm with
other controls that do seem to work on other machines. The only difference I
can perceive is that this DoCmd.OpenForm includes the wherecondition
criteria, while the functional code does not filter the form. I'm stumped
for now.
 

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