Hello,
What I am trying to do is have one form loop through its combo boxes and check to see if the value is a key word like Query_Form or Query_Form2. What I then want to happen is in either case to call another form that does on the fly calculations and then stores them in separate queries.
On this new calculation form I want to have a way of saying something along the lines of
If 'the other form' says Query_Form .. then call this version of the query
ElseIf 'the other form' says Query_Form2 ... then call this version of the query
My Code so far is as follows..
For the first form:
For the calculation form I then have:
I know the mistake is most likely in the Forms!Make_Repo rt.Controls() statement, but I don't know how to check which combo box on the other form it is.
Any help would be greatly appreciated. Thanks!
What I am trying to do is have one form loop through its combo boxes and check to see if the value is a key word like Query_Form or Query_Form2. What I then want to happen is in either case to call another form that does on the fly calculations and then stores them in separate queries.
On this new calculation form I want to have a way of saying something along the lines of
If 'the other form' says Query_Form .. then call this version of the query
ElseIf 'the other form' says Query_Form2 ... then call this version of the query
My Code so far is as follows..
For the first form:
Code:
For i = 1 To 29
If Me.Controls("cboField" & i) = "Query_Form" Then
'Opens frmVarCalc form as a dialog box so user must take action before rest of code is run
DoCmd.OpenForm "frmVarCalc", , , , , acDialog
ElseIf Me.Controls("cboField" & i) = "Query_Form2" Then
DoCmd.OpenForm "frmVarCalc", , , , , acDialog
End If
Next i
Code:
If Forms!Make_Report.Controls() = "Query_Form" Then
Call fCreateQueries("VarCalc_Query")
Call fCreateUpdateQueries("Update_Projects")
ElseIf Forms!Make_Report.Controls() = "Query_Form2" Then
Call fCreateQueries("VarCalc_Query_Two")
Call fCreateUpdateQueries("Update_Projects_Two")
End If
Any help would be greatly appreciated. Thanks!
Comment