Have two forms each of which are based upon their own tables and are linked by a case number that is the primary key in the case table and a foreign key in the hearing table. Button on the case form that opens the hearing and let the user enter in the information that is needed for the hearing. My problem is that I can not get the case number to copy from the case form and be entered into the hearing from to work.
Here is the code that I am working with:
Dim stDocName As String
Dim stLinkCriteria As String
Dim caseNum As String
caseNum = Me![CASE_NUMBER]
stDocName = "frmCaseHearing"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord acDataForm, "frmCaseHearing", acNewRec
Me![CASE_NUMBER] = caseNum
When I click on the schedule hearing button where the code is, I get the following error:
The expression you entered refers to an object that is closed or doesn't exist.
What do I need to change in my code to get it to work?
Thanks in advance,
Mike
Here is the code that I am working with:
Dim stDocName As String
Dim stLinkCriteria As String
Dim caseNum As String
caseNum = Me![CASE_NUMBER]
stDocName = "frmCaseHearing"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord acDataForm, "frmCaseHearing", acNewRec
Me![CASE_NUMBER] = caseNum
When I click on the schedule hearing button where the code is, I get the following error:
The expression you entered refers to an object that is closed or doesn't exist.
What do I need to change in my code to get it to work?
Thanks in advance,
Mike