Using combo box to open forms and reports

boge

Registered User.
Local time
Today, 19:39
Joined
Mar 21, 2005
Messages
16
I have a database that have few tables with records, every table has a field with names for every record entered,
I am trying to make a form, where I have combo box made from that field with names, and command buttons for oppening different forms and reports of the particular name that I choose from the combo box.
I have made a macro that determines that the value from the combo box has to be equal with the record of the opened forms but I am getting just new forms.

I still can not do it, can someone help me?
 
On the OnClick event of the button have something like this:

Dim ComboValue as String

ComboValue = [combo box name]

DoCmd.OpenForm ComboValue

That should take the value of the combo box and put it into the variable ComboValue, and then use the ComboValue variable as the form name in the openform command.

Hope this helps
 
Thanks for your time!

I am afraid it is not working, when I click the command buton it shows

"Runtime error 2102 - The form name "3" (that is the ID number of the record I am lookin up in combo box) is misspelled or refers to a form that do not exists"

When I clik Debug, then it shows problem in line

DoCmd.OpenForm ComboValue

It seems that the button is not recognizing the ComboValue as form?
 
Hey Boge,

It sounds like your referring to the wrong column in your cboBox. If the form names are in you cboBox, check the rowsource of your cboBox and see which column the form names are in. Access starts numbering at 0, so if the form names are in column 2 then you would refer to that column as (1), so your code would need to change just a little.

Dim ComboValue as String

ComboValue = [combo box name].Column(1)

DoCmd.OpenForm ComboValue

HTH,
Shane
 
Combo box

Yes there was problem with ComboBox, but I cleared it now - it has one column,
but the result is similar as previous, it is not working :(

Here is the example database www.korab.org.mk/db2.zip that I am using.
 

Users who are viewing this thread

Back
Top Bottom