Need help with coding comman button on form...

M

Mary A Perez

The current code is as follows:
Private Sub cmdCurrentContractRatesandSpecifications_Click()
On Error GoTo Err_cmdCurrentContractRatesandSpecifications_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCurrentRates-SpecificationsMain-South"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdCurrentContractRatesandSpecifica:
Exit Sub

Err_cmdCurrentContractRatesandSpecifications_Click:
MsgBox Err.Description
Resume Exit_cmdCurrentContractRatesandSpecifica

End Sub

I need the command button upon clicking to go to a specified
"frmCurrentRates-SpecificationsMain-South" based upon the choices of the
combo boxes in this form "cmbPlan" and "cmbProduct".

Can anyone help me do this?
Thanks for your time & expertise.
 
O

Ofer

I'm not sure what the type of the fields, or the names, so you'll need to
make some modification to that


stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = " & Me.cmbPlan & " and [Product Field
name] = " & Me.cmbProduct
DoCmd.OpenForm stDocName, , , stLinkCriteria
============================================
Now if the field type is string, you need to add a singlr quote before and
after the value from the combo
stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = '" & Me.cmbPlan & "' and [Product
Field name] = '" & Me.cmbProduct & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
=============================================
In the square brackets write the name of the field in the form
 
F

fredg

The current code is as follows:
Private Sub cmdCurrentContractRatesandSpecifications_Click()
On Error GoTo Err_cmdCurrentContractRatesandSpecifications_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCurrentRates-SpecificationsMain-South"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdCurrentContractRatesandSpecifica:
Exit Sub

Err_cmdCurrentContractRatesandSpecifications_Click:
MsgBox Err.Description
Resume Exit_cmdCurrentContractRatesandSpecifica

End Sub

I need the command button upon clicking to go to a specified
"frmCurrentRates-SpecificationsMain-South" based upon the choices of the
combo boxes in this form "cmbPlan" and "cmbProduct".

Can anyone help me do this?
Thanks for your time & expertise.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCurrentRates-SpecificationsMain-South"

' Assuming the bound columns of cmbPlan and cmbProduct are text as
well as the Plans and Products fields datatypes, then:

stLinCriteria = "[Plans] = '" & Me!cmbPlan & "' AND [Products] = '" &
Me!cmbProduct & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria
 
M

Mary A Perez

Thanks so much for your help.
Have a great rest of the week & weekend!

Ofer said:
I'm not sure what the type of the fields, or the names, so you'll need to
make some modification to that


stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = " & Me.cmbPlan & " and [Product Field
name] = " & Me.cmbProduct
DoCmd.OpenForm stDocName, , , stLinkCriteria
============================================
Now if the field type is string, you need to add a singlr quote before and
after the value from the combo
stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = '" & Me.cmbPlan & "' and [Product
Field name] = '" & Me.cmbProduct & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
=============================================
In the square brackets write the name of the field in the form

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Mary A Perez said:
The current code is as follows:
Private Sub cmdCurrentContractRatesandSpecifications_Click()
On Error GoTo Err_cmdCurrentContractRatesandSpecifications_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCurrentRates-SpecificationsMain-South"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdCurrentContractRatesandSpecifica:
Exit Sub

Err_cmdCurrentContractRatesandSpecifications_Click:
MsgBox Err.Description
Resume Exit_cmdCurrentContractRatesandSpecifica

End Sub

I need the command button upon clicking to go to a specified
"frmCurrentRates-SpecificationsMain-South" based upon the choices of the
combo boxes in this form "cmbPlan" and "cmbProduct".

Can anyone help me do this?
Thanks for your time & expertise.
 
M

Mary A Perez

Ok, I must have missed something. Sorrry.

The data that needs to go in the brackets. I'm not sure there is a field
name because of the query in the combo box event procedures. There is a
query that when the user chooses from the drop down, only the products tied
to that plan our shown in the product compbo box drop down.
Once these fields are populated, the user will choose the command button for
their choice which upon the click event, will go to the frm based upon the
choices of the plan and product.
So, I think I'm placing the wrong data in the brackets.
I apologize again for being so dense, but appreciate all your help.

Ofer said:
I'm not sure what the type of the fields, or the names, so you'll need to
make some modification to that


stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = " & Me.cmbPlan & " and [Product Field
name] = " & Me.cmbProduct
DoCmd.OpenForm stDocName, , , stLinkCriteria
============================================
Now if the field type is string, you need to add a singlr quote before and
after the value from the combo
stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = '" & Me.cmbPlan & "' and [Product
Field name] = '" & Me.cmbProduct & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
=============================================
In the square brackets write the name of the field in the form

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Mary A Perez said:
The current code is as follows:
Private Sub cmdCurrentContractRatesandSpecifications_Click()
On Error GoTo Err_cmdCurrentContractRatesandSpecifications_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCurrentRates-SpecificationsMain-South"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdCurrentContractRatesandSpecifica:
Exit Sub

Err_cmdCurrentContractRatesandSpecifications_Click:
MsgBox Err.Description
Resume Exit_cmdCurrentContractRatesandSpecifica

End Sub

I need the command button upon clicking to go to a specified
"frmCurrentRates-SpecificationsMain-South" based upon the choices of the
combo boxes in this form "cmbPlan" and "cmbProduct".

Can anyone help me do this?
Thanks for your time & expertise.
 
M

Mary A Perez

Never Mind. I figured out that the field name is from the form I want to
open not the form I'm opening from.
It's been a long day.
I'm still trying to get the code to work. I must be doing something wrong.
Maybe trying fresh in the morning.
Thanks again.

Mary A Perez said:
Ok, I must have missed something. Sorrry.

The data that needs to go in the brackets. I'm not sure there is a field
name because of the query in the combo box event procedures. There is a
query that when the user chooses from the drop down, only the products tied
to that plan our shown in the product compbo box drop down.
Once these fields are populated, the user will choose the command button for
their choice which upon the click event, will go to the frm based upon the
choices of the plan and product.
So, I think I'm placing the wrong data in the brackets.
I apologize again for being so dense, but appreciate all your help.

Ofer said:
I'm not sure what the type of the fields, or the names, so you'll need to
make some modification to that


stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = " & Me.cmbPlan & " and [Product Field
name] = " & Me.cmbProduct
DoCmd.OpenForm stDocName, , , stLinkCriteria
============================================
Now if the field type is string, you need to add a singlr quote before and
after the value from the combo
stDocName = "frmCurrentRates-SpecificationsMain-South"
stLinkCriteria = "[Plan Field Name] = '" & Me.cmbPlan & "' and [Product
Field name] = '" & Me.cmbProduct & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
=============================================
In the square brackets write the name of the field in the form

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Mary A Perez said:
The current code is as follows:
Private Sub cmdCurrentContractRatesandSpecifications_Click()
On Error GoTo Err_cmdCurrentContractRatesandSpecifications_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCurrentRates-SpecificationsMain-South"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdCurrentContractRatesandSpecifica:
Exit Sub

Err_cmdCurrentContractRatesandSpecifications_Click:
MsgBox Err.Description
Resume Exit_cmdCurrentContractRatesandSpecifica

End Sub

I need the command button upon clicking to go to a specified
"frmCurrentRates-SpecificationsMain-South" based upon the choices of the
combo boxes in this form "cmbPlan" and "cmbProduct".

Can anyone help me do this?
Thanks for your time & expertise.
 

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