Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing text in Text Box depending on 2 different combo box

Status
Not open for further replies.

Diezz

Technical User
Dec 24, 2004
61
NL
I m having 2 forms, "frmApp" and "frmRes".
In frmapp i have 2 combo box, cboProb and cboMVS.
If i make the selection "Applications MVS" from cboProb, then cboMVS becomes visible, this box is put on visible false by default.

Then i can click the buton resolution and it opens the new form "frmRes" with a text box as a title. If the selection in cboProb it's different from "applications MVS" then i want it to appear in the title, if the selection is "applications MVS" i want the title to be the selection i chose from cboMVS.

This is what i ve tried so far:

Private Sub Form_Open(Cancel As Integer)
If [Forms]![frmApp]![cboMVS].Visible = True Then
Text0.Text = [Forms]![frmApp]![cboMVS].[Column](1)
Else
Text0.Text = [Forms]![frmApp]![cboTypePb].[Column](1)
End If

Whenever i ckick the buton "resolution" however it gives me the message "Wrong number of arguments or invalid propriety assignment".

Anyone can help me?

Thanks
 
Try:
Private Sub Form_Load(Cancel As Integer)
If [Forms]![frmApp]![cboMVS].Visible = True Then
Me.Text0 = [Forms]![frmApp]![cboMVS].[Column](1)
Else
Me.Text0 = [Forms]![frmApp]![cboTypePb].[Column](1)
End If
 
Hello Remou,

Thanks for your answer.

I've tried your solution however it gaves me the same error and it highlights "Me.txtTitle = [Forms]![frmApp]![cboTypePb].[Column](1)".
 
Does your combo have two columns, so that there is a column(1) to be returned?
 
Hello Remou,

This is cboTypePB : "SELECT [Types problemes].[Code Type Pb], [Types problemes].[Type Probleme], [Types problemes].[Code Probleme], [Types problemes].[Code Equipe], [Types problemes].[Details Type Probleme], [Types problemes].EtapesàSuivre, [Types problemes].Infosàdemander FROM [Types problemes] WHERE ((([Types problemes].[Code Probleme])=Forms!frmApp!cboProbleme));"

And this is cboMVS "SELECT [Applications MVS].CodeMVS, [Applications MVS].[MVS Application], [Applications MVS].[à savoir], [Applications MVS].[Code Type Pb], [Applications MVS].[Code Equipe] FROM [Applications MVS] WHERE ((([Applications MVS].[Code Type Pb])=Forms!frmApp!cboTypePb)); "

So yes i have more than 2 columns in every cbo, so i need column(1) returnet, for :

cboTypePb : Type Probleme
cboMVS : MVS Application

Basicaly after i select the application from one combo box i want a new form with its name as a title. I can easily make this by simply using "=[forms]![frmApp]![cboTypePb].column(1).

However, cboMVS makes think harder and as i already said, if cbotypePb.value = "Applications MVS" then cboMVS becomes visible and i want cboMVS.column(1) to appear as the new title in the new form.

 
I missed a point, try:
[tt]Private Sub Form_Load
If [Forms]![frmApp]![cboMVS].Visible = True Then
Me.txtTitle = [Forms]![frmApp]![cboMVS].Column(1)
Else
Me.txtTitle = [Forms]![frmApp]![cboTypePb].Column(1)
End If[/tt]

That is, no brackets on the column.

There may be advantages in using OpenArgs.
 
Hello Remou,

It worked, thank you very much!:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top