C
cableguy47905 via AccessMonster.com
I am having the hardest time trying to pass a single value from one form to
another form that I am opening with a cmd button.
I have a main form that is already populated and I am trying to open a new
form that will have one value passed to it from the original form. This new
form will be data entry and the value that I am passing to it will be one
half of the primary key for the query that the form is based on. The other
half would be entered in once the form is opened.
I have tried every example that is on this discussion board, and I still have
no luck. I have tried it in the Where statement, but just get it filtered,
but still no values showing up. I guess ultimately I do want it filtered on
the CompanyID, that way the rest of the fields would fill in also, but I
still just get it to open to a blank form.
Here is my code. I don't get errors, I also don't get anything for that
control either. CompanyID is numeric.
Can anyone help?
Thanks in advance,
Lee
Private Sub cmdAddContract_Click()
On Error GoTo Err_cmdAddContract_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FRM_CompanyAddContracts"
stLinkCriteria = "txtCompanyID.defaultvalue =" & Me.txtCompanyID
DoCmd.OpenForm stDocName, , , , acFormAdd, acWindowNormal, stLinkCriteria
Exit_cmdAddContract_Click:
Exit Sub
Err_cmdAddContract_Click:
MsgBox Err.Description
Resume Exit_cmdAddContract_Click
End Sub
another form that I am opening with a cmd button.
I have a main form that is already populated and I am trying to open a new
form that will have one value passed to it from the original form. This new
form will be data entry and the value that I am passing to it will be one
half of the primary key for the query that the form is based on. The other
half would be entered in once the form is opened.
I have tried every example that is on this discussion board, and I still have
no luck. I have tried it in the Where statement, but just get it filtered,
but still no values showing up. I guess ultimately I do want it filtered on
the CompanyID, that way the rest of the fields would fill in also, but I
still just get it to open to a blank form.
Here is my code. I don't get errors, I also don't get anything for that
control either. CompanyID is numeric.
Can anyone help?
Thanks in advance,
Lee
Private Sub cmdAddContract_Click()
On Error GoTo Err_cmdAddContract_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FRM_CompanyAddContracts"
stLinkCriteria = "txtCompanyID.defaultvalue =" & Me.txtCompanyID
DoCmd.OpenForm stDocName, , , , acFormAdd, acWindowNormal, stLinkCriteria
Exit_cmdAddContract_Click:
Exit Sub
Err_cmdAddContract_Click:
MsgBox Err.Description
Resume Exit_cmdAddContract_Click
End Sub