Pass value from one form to another

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I have the below code that I wanted to pass the value from From frmNavigation.
SalesPersSelect to frmQuotes.Salesperson when the user click the
cmdCreateQuote button. I get a message that says data member not found. Can
anyone help?

Thanks

Private Sub cmdCreateQuote_Click()
On Error GoTo Err_cmdCreateQuote_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmQuotes"

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Forms!frmNavigation.cboSalesPersSelect = Me.Salesperson

Exit_cmdCreateQuote_Click:
Exit Sub

Err_cmdCreateQuote_Click:
msgbox Err.Description
Resume Exit_cmdCreateQuote_Click
End Sub
 
D

Dirk Goldgar

mattc66 via AccessMonster.com said:
I have the below code that I wanted to pass the value from From
frmNavigation.
SalesPersSelect to frmQuotes.Salesperson when the user click the
cmdCreateQuote button. I get a message that says data member not found.
Can
anyone help?

Thanks

Private Sub cmdCreateQuote_Click()
On Error GoTo Err_cmdCreateQuote_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmQuotes"

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Forms!frmNavigation.cboSalesPersSelect = Me.Salesperson

Exit_cmdCreateQuote_Click:
Exit Sub

Err_cmdCreateQuote_Click:
msgbox Err.Description
Resume Exit_cmdCreateQuote_Click
End Sub


It looks to me like you've got your assignment statement reversed. If this
code is running on frmNavigation, shouldn't it be:

Forms!frmQuotes.Salesperson = Me.cboSalesPersSelect

?
 
M

mattc66 via AccessMonster.com

That was it.. Thanks

Dirk said:
I have the below code that I wanted to pass the value from From
frmNavigation.
[quoted text clipped - 23 lines]
Resume Exit_cmdCreateQuote_Click
End Sub

It looks to me like you've got your assignment statement reversed. If this
code is running on frmNavigation, shouldn't it be:

Forms!frmQuotes.Salesperson = Me.cboSalesPersSelect

?
 

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

Similar Threads


Top