Newbie ?--pop-up text box based on combo choice?

  • Thread starter Thread starter Sboynton
  • Start date Start date
S

Sboynton

Guest
I'm very new to Access, so any replies, please pretend you're explaining it to a 2 year old!

I have a combo box called "method of withdrawal" (WDMethod) which contains 3 choices: Withdrawn for cash, Deposited, or Assigned to third party. When a user chooses "withdrawn for cash" I would like nothing to happen--they just go to the next field. But if they choose "deposited" I would like something to pop up and ask them for the account name and account number, and then when they input that, it is automatically added to the record. Same for if they choose "assigned to third party"--a box pops up and asks them for the name of the third party.

I've set up fields in my table for each of those "if" answers--they are "DpstName" "DpstAcctNo" and "ThrdPrtyName"

Did I explain this correctly? Is it possible, and if not, can someone suggest a similar way to accomplish the same thing?

Remember---2 year old language here! I'm clueless!
smile.gif
 
You are in luck. I have a two year old at home.

First, create the text boxes on your form for account name (DpstName), account number (DpstAcctNo), and name of third party (ThrdPrtyName) as you normally would. You may want to rearrange them later when you see what we will do to them. For example, you can put them on top of each other.
Second, set the Visible properties for all three to "No". This will make them invisible when you open the form.
Now, let's try some code. In the AfterUpdate property, select "Event Procedure" and click on the "..." to the right of it. In the AfterUpdate event procedure your code should look like this:

Private Sub WDMethod_AfterUpdate()

If WDMethod = "Withdrawn for Cash" Then
DpstName.Visible = False
DpstAcctNo.Visible = False
ThrdPrtyName.Visible = False
End If
If WDMethod = "Deposited" Then
DpstName.Visible = True
DpstAcctNo.Visible = True
ThrdPrtyName.Visible = False
End If
If WDMethod = "Assigned to third party" Then
DpstName.Visible = False
DpstAcctNo.Visible = False
ThrdPrtyName.Visible = True
End If

End Sub

I know that this is not as tight as my contemporaries would make it but I tried to make it very easy to follow. For the first series, a selection of "Withdrawn for Cash" makes all three text boxes invisible (in case they were visible from a previous entry). The second and third series make the appropriate text boxes visible and invisible as the selection would dictate. You will want to substitute "Withdraw for Cash" and the others with the exact wording of your combo box.

If you get this right, you'll get a treat!!!
 
AlaskanDad - Your response to this persons question was perfect. I tried consulting the help function; looking in my "help" book; and tried working through it via "trial and error. However, your explanation just saved me amazing amounts of frustration. Thanks for putting things in 2 year old terms.
 

Users who are viewing this thread

Back
Top Bottom