I have been doing fine with autofilling forms that are part of a tab and moving between tabs, etc. But the form I'm having problems with now is a separate form that is opened when a button is pressed (Create RMA). This is the code I have tied to the button on the OnClick event.
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "UnitRepairHx"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Me.[UnitRepairHx].Form![UnitID] = Forms!Main.WorkOrders![UnitID]
Me.[UnitRepairHx].Form![DateCreated] = Date
Me.[UnitRepairHx].Form![WorkorderID#] = Forms!Main.WorkOrders![WorkorderID#]
Me.[UnitRepairHx].Form![ProblemDescription] = Forms!Main.WorkOrders![ProblemDescription]
Exit_Command27_Click:
Exit Sub
Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click
End Sub
When I click the button I get the following error:
"Databasename can't find the field '|' referred to in your expression"
Any ideas what I'm doing wrong?
Thank you in advance.
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "UnitRepairHx"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Me.[UnitRepairHx].Form![UnitID] = Forms!Main.WorkOrders![UnitID]
Me.[UnitRepairHx].Form![DateCreated] = Date
Me.[UnitRepairHx].Form![WorkorderID#] = Forms!Main.WorkOrders![WorkorderID#]
Me.[UnitRepairHx].Form![ProblemDescription] = Forms!Main.WorkOrders![ProblemDescription]
Exit_Command27_Click:
Exit Sub
Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click
End Sub
When I click the button I get the following error:
"Databasename can't find the field '|' referred to in your expression"
Any ideas what I'm doing wrong?
Thank you in advance.