actionbasti
Programmer
Hi,
I am really new to adp and access.
I am trying to open a form based on a listbox selected item. That works great but i cannot close the origin form. This code gives me an error. The close command just closes everything and brings the following error message:
The expression you entered refers to an object that is closed or doesn't exist.
CODE:
Private Sub btnNewProject_Click()
On Error GoTo Err_btnNewProject_Click
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
gCurrentProjectID = List3.ItemData(List3.ListIndex)
stLinkCriteria = "[project_id]=" & gCurrentProjectID
stDocName = "frmNewProject"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnNewProject_Click:
Exit Sub
Err_btnNewProject_Click:
MsgBox Err.Description
Resume Exit_btnNewProject_Click
End Sub
I have the same code with the stLinkCriteria as an empty string, and there it works great, when i open the form, the original form closes. but here it doesnt work... why?
I am really new to adp and access.
I am trying to open a form based on a listbox selected item. That works great but i cannot close the origin form. This code gives me an error. The close command just closes everything and brings the following error message:
The expression you entered refers to an object that is closed or doesn't exist.
CODE:
Private Sub btnNewProject_Click()
On Error GoTo Err_btnNewProject_Click
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
gCurrentProjectID = List3.ItemData(List3.ListIndex)
stLinkCriteria = "[project_id]=" & gCurrentProjectID
stDocName = "frmNewProject"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnNewProject_Click:
Exit Sub
Err_btnNewProject_Click:
MsgBox Err.Description
Resume Exit_btnNewProject_Click
End Sub
I have the same code with the stLinkCriteria as an empty string, and there it works great, when i open the form, the original form closes. but here it doesnt work... why?