Select from a combo box

zashmore

Registered User.
Local time
Today, 13:28
Joined
Apr 21, 2008
Messages
21
Hi all,

I have a form with a combo box with the following selections:

No Contact
Support Commenced
Refused by Agency
Refused by Tenant

What I want sounds simple,

if i select one of these, for example, Refused by Agency a form pops up and asks to input reasons why.
Or if Support Commenced is selected a form appears and asks for the workers name to be inputted.

Any help on macro's or VB would be much appreciated.

Thanks
 
Hi
This will depend on whether you want those additional fields, for names, reasons etc., to be on the same form or on another. Personally, I would put them on the same form unless there's going to be mulitple fields to complete depending on the selection in your original field.

Anyway, in my attached example, I have put all fields in one table. On the form, I have put Field1 as normal but when I put the other four fields on the form, I stacked them one on top of the other, so that they all overlap. On the property sheet, I set the Visible property of each of these four to No. Therefore, when you open the form, you don't see these fields at all, just the "main" field.

I then created some code in the After_Update event of field1. Basically, all this does is check what you entered and then switch the Visible property back on for whichever of the other four fields it relates to.

I'm a VERY amateur coder, so there are probably far better ways of doing this, but it works as far as I can see.
 

Attachments

Rats! I just opened the zip file I uploaded and it doesn't seem to update the form properly. That MIGHT be because it's read only after being zipped? I don't know. Anyway, if you go to design view of Form1, it will at least let you LOOK at what I did.

In this view, double-click Field1 and go to the Event tab of the Property sheet. You will see an EvenT Procedure on the After Update line. Click that line then click the three dots that appear at the end of the line and it will open up the code I created for the form.

I hope this helps.
 
Cool!

Looks good to me. Will try it out.

Thanks very much.
 

Users who are viewing this thread

Back
Top Bottom