PicassoB
04-11-2008, 02:14 PM
Please could anyone help
I have a form with six drop down fields in ie- Pshop1 to P6 is there a code to enable me to run a search criteria on all six
cheers Richard
Guus2005
04-14-2008, 02:52 AM
Yes. Loop through all controls. Use tags or typeof to find the controls you need.
PicassoB
04-14-2008, 08:59 AM
Guus2005
thanks for the reply - but I am not experianced in code writing and do not realy understand your reply, I have used the basic Access search criteria on the first field but need to run a report and the paintshop name could be in any of the six fields
could you expain in laymans terms please
regards Richard
Guus2005
04-14-2008, 11:37 PM
I hope you have *some* VBA expreience?
There are several ways to accomplish this. Here are two:
Use the TAG property of the control:
Enter "imhere" (w/o quotes) in every TAG property of each control you wish to find.
Using a loop in VBA you can easily find these controls by checking if the TAG property equals "imhere"
dim ctl as control
for each ctl in frm.controls
if ctl.tag = "imhere" then
'Found one!
endif
next ctlOr you can check the type of the control:
dim ctl as control
for each ctl in frm.controls
If TypeOf ctl Is ComboBox Then
'Found a combobox
End If
next ctlAs you can see, the last routine searches specifically a combobox.
HTH:D
PicassoB
04-16-2008, 01:19 AM
Thanks Guus2005
unfortunatly i am not that experianced in VBA - where do I install the code? and also i do not understand the (w/o quotes)
sorry to sound totaly naive but unlees Access wizard does it for me I am stuck
much appreciate you help
Regards Richard
Guus2005
04-16-2008, 11:40 PM
To get a little more experiance check out: Solutions9.mdb(internet) and the Northwind.mdb(comes with Access) databases.
Type alt-f11 to get the visual basic editor.
Enjoy!
BTW (By the way) w/o quotes means without quotes.