combo box selection

G

Guest

In my form there is a combo box which has three selection "deposit",
"withdraw" and "transfer" depending upon this selection different text will
appear in next three text box, for example if the selection is " deposit"
then the text box "transfered by" should read "NA". and if the selection is
"Transfer" the same text box remains empty to be filled. This is happening
now and it is good.
But if I change selection (or reselct to) from "depost" to "transfer" then
still the text box "transferred by" reads "NA"\
what I want is, when I change the selction in combo box, the text box
should also change to corresponding value. How to achieve this?? Please help
 
L

Larry Linson

senkurion said:
In my form there is a combo box which has three selection "deposit",
"withdraw" and "transfer" depending upon this selection different text
will
appear in next three text box, for example if the selection is " deposit"
then the text box "transfered by" should read "NA". and if the selection
is
"Transfer" the same text box remains empty to be filled. This is happening
now and it is good.
But if I change selection (or reselct to) from "depost" to "transfer" then
still the text box "transferred by" reads "NA"\
what I want is, when I change the selction in combo box, the text box
should also change to corresponding value. How to achieve this?? Please
help

I presume you have VBA code in the AfterUpdate event of the Combo Box to set
the text boxes? You didn't say.

If the VBA code sets a value in each of the three Text Boxes for each
possible choice, then resetting the Combo should cause the values in the
Text Boxes to be reset. On the other hand, if you presumed that Access will
realize that the Text Boxes should automatically revert to some particular
value and reset them automatically, that is not the case.

It should resemble this (untested) air code:

If Me.cboTheComboName = "deposit" Then
Me.TransferredBy = "N/A" 'Not Applicable
Me.OtherTextBox2 = ...
Me.OtherTextBox3 = ...
ElseIf Me.cboTheComboName = "transfer" Then
Me.TransferredBy = "" 'Clear any existing
value/text
Me.OtherTextBox2 = ...
Me.OtherTextBox3 = ...
ElseIf Me.cboTheComboName = "withdraw" Then
Me.TransferredBy = "N/A" 'Not Applicable
Me.OtherTextBox2 = ...
Me.OtherTextBox3 = ...
Else
MsgBox "Invalid entry in Combo Box"
End If

Larry Linson
Microsoft Access MVP
 
G

Guest

Sorry for not giving you complete scenario. yes I do have after update event
procedure for combo box. these vent procedure are exactly as u suggested. The
only problem is when i select say "deposit" the text box "transferred by"
read "NA" but when i change the selection to say "transfer" i wanted "NA" to
disappear so that i can fill the name, but it does not happens. even after
changing to "transfer" the text box still reads to "NA". According to you it
should change, but this is not happening please help
 
G

Guest

Thank you it worked, what I missed was "else if" I checked what you suggested
and changed accordingly it worked. Thank you once again
 

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