[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 812
  • Last Modified:

using if statement on a form based on one combo box to fill another

Hello,
I am using an access form.
I use an if statement : If me.cboOne = "14545" Then
me.txtOne = "LC12 GB"
I base the text box on what the combo box is.
QUESTION: Is there a way to base a 2nd combo box on what first combo box is?
thank you
0
davetough
Asked:
davetough
  • 3
  • 2
1 Solution
 
wiswalldCommented:
If you are trying to base a combo box on another try this.

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23000738.html?cid=236#a20404439

That would be if you have multiple columns in a table and if the first column equals lets say 1 then only options where the first column equalled 1 would show in the second combobox.

Is that what you mean or just a simple if statement?
0
 
davetoughAuthor Commented:
I guess I mean a simple statement
like  If me.cboOne = " choice one" Then
me.cboTwo = ( choice one, choice two, or choice three)
can you do it anyway like that?
or is your solution more the way you have to do it?
thanks
0
 
wiswalldCommented:
If you have a table set up like this then the first solution would be your best option

1      Doug
2      Dave
2      Jennifer
2      Alyssa
3      Sally

So if you select 2 in combo1 then only Dave, Jennifer and Alyssa would appear in combo2.

You can write a long If statement but that depends on how many items are in you first combobox

If Me.Combo1 = "1" Then
Me.Combo2 = "2"
Else
If Me.Combo1 = "2" Then
Me.Combo2 = "3"
End If
0
 
wiswalldCommented:
Let me know if you need further
0
 
davetoughAuthor Commented:
thanks again
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now