Open Form based u pon a value from a test box; code needed

G

Guest

Hello,
Got a Form called switchboard, I would like to open another form, Concern
Analysis, based upon a value that is present in a text box on the switchboard.

I already have the button on the switchboard to open the 2nd form that are
linked on the primarey key, Analysis Number.
See the code below:

Private Sub Open_Concern_Analysis_Click()
On Error GoTo Err_Open_Concern_Analysis_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "RepairForm"
stLinkCriteria = "[AnalysisNumber]=" & Me![AnalysisNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria

''something like: If textbox= true, then open Concern Analysis

Exit_Open_Black_Tie_Concern_Analysis_Rep:
Exit Sub
Err_Open_Concern_Analysis_Click:
MsgBox Err.Description
Resume Exit_Open_Concern_Analysis_Rep
End Sub

TIA!!!
 
G

Guest

i come from Hong Kong, my english not good, i hope i know your question
meaning.

firstly, are you want to open the another form from switchboard form and
pass a value to the another form for use
later? e.g. using this value in another open form's OnOpen or OnLoad event

if yes, you can use OpenArgs in OpenForm Method(i.e. the last augurment in
that method)
e.g. Docmd.OpenForm yourFormName,,,,,,yourValue

when another form's OnOpen event
e.g. If Me.OpenArgs = yourValue then ....



"Dirty70Bird" 來函:
 
G

Guest

Hello Rainbow,
Docmd.OpenForm yourFormName,,,,,,yourValue

This worked, but it always opens the form, it is like it works with no
"yourvalue" (criteria) present



Rainbow01 said:
i come from Hong Kong, my english not good, i hope i know your question
meaning.

firstly, are you want to open the another form from switchboard form and
pass a value to the another form for use
later? e.g. using this value in another open form's OnOpen or OnLoad event

if yes, you can use OpenArgs in OpenForm Method(i.e. the last augurment in
that method)
e.g. Docmd.OpenForm yourFormName,,,,,,yourValue

when another form's OnOpen event
e.g. If Me.OpenArgs = yourValue then ....



"Dirty70Bird" 來函:
Hello,
Got a Form called switchboard, I would like to open another form, Concern
Analysis, based upon a value that is present in a text box on the switchboard.

I already have the button on the switchboard to open the 2nd form that are
linked on the primarey key, Analysis Number.
See the code below:

Private Sub Open_Concern_Analysis_Click()
On Error GoTo Err_Open_Concern_Analysis_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "RepairForm"
stLinkCriteria = "[AnalysisNumber]=" & Me![AnalysisNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria

''something like: If textbox= true, then open Concern Analysis

Exit_Open_Black_Tie_Concern_Analysis_Rep:
Exit Sub
Err_Open_Concern_Analysis_Click:
MsgBox Err.Description
Resume Exit_Open_Concern_Analysis_Rep
End Sub

TIA!!!
 

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