R
Ruth
I'm having trouble making this work. I have a form that displays an
unbound listbox of existing assessments in my DB (Access 2003). When
an assessment is selected, the user clicks the Open button on the
form, and the following code executes.
Private Sub btnOpenExstAssess_Click()
On Error GoTo Err_btnOpenExstAssess_Click
Dim stDocName As String
Dim StLinkCriteria As String
If Me![lstAssess] = Null Then
MsgBox "Please select an Assessment from the list.",
vbCritical, "No Selection Made"
Else
stDocName = "Question Main"
StLinkCriteria = "[ReviewID]=" & "'" & Me![lstAssess] & "'"
DoCmd.OpenForm stDocName, , , StLinkCriteria
DoCmd.Close acForm, "frmOpenExist"
End If
Exit_btnOpenExstAssess_Click:
Exit Sub
Err_btnOpenExstAssess_Click:
MsgBox Err.Description
Resume Exit_btnOpenExstAssess_Click
End Sub
The If part doesn't work. It still opens a blank form which is missing
all my custom navigation buttons, including the button that closes the
form and returns to the Main Menu. Basically, if a user doesn't select
an assessment from the list, they are stuck on a dead end form.
The underlying VB for the listbox's contents is:
SELECT tblReviews.ReviewID, tblReviews.OrgName, tblReviews.RevDate
FROM tblReviews
ORDER BY tblReviews.RevDate DESC , tblReviews.OrgName;
Thanks for any help!
Ruth
unbound listbox of existing assessments in my DB (Access 2003). When
an assessment is selected, the user clicks the Open button on the
form, and the following code executes.
Private Sub btnOpenExstAssess_Click()
On Error GoTo Err_btnOpenExstAssess_Click
Dim stDocName As String
Dim StLinkCriteria As String
If Me![lstAssess] = Null Then
MsgBox "Please select an Assessment from the list.",
vbCritical, "No Selection Made"
Else
stDocName = "Question Main"
StLinkCriteria = "[ReviewID]=" & "'" & Me![lstAssess] & "'"
DoCmd.OpenForm stDocName, , , StLinkCriteria
DoCmd.Close acForm, "frmOpenExist"
End If
Exit_btnOpenExstAssess_Click:
Exit Sub
Err_btnOpenExstAssess_Click:
MsgBox Err.Description
Resume Exit_btnOpenExstAssess_Click
End Sub
The If part doesn't work. It still opens a blank form which is missing
all my custom navigation buttons, including the button that closes the
form and returns to the Main Menu. Basically, if a user doesn't select
an assessment from the list, they are stuck on a dead end form.
The underlying VB for the listbox's contents is:
SELECT tblReviews.ReviewID, tblReviews.OrgName, tblReviews.RevDate
FROM tblReviews
ORDER BY tblReviews.RevDate DESC , tblReviews.OrgName;
Thanks for any help!
Ruth