Okay, this should be so easy, but I'm stuck!
I have a table - tblFaceSheet - stores the values that pull to a form. I also created qryFaceSheet for the data in the table.
I have a form for users to select which review they wish to edit - simple combo box (cboSelectCase) that has the review #, the case name, & the review date (I'm basing the cbo on the qry from the FaceSheet table). Review # is primary key, but they won't know that info - they'll need to see the name/date combo to pick the record they want to edit.
The "Go" button on the form with the combo box is supposed to open frmReviewEdit, & it's supposed to populate the form with the info from the table (or query - which is better to use?) based on the choice in the combo box. This must be the easiest, most obvious code in the world! But I'm getting a run-time error on it.
Here's the code:
Private Sub cmdEditReview_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmFaceSheetEdit"
stLinkCriteria = "[Review_No] ='" & cboSelectCase & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
DoCmd.RunCommand acCmdFilterByForm
DoCmd.Maximize
End Sub
On the form, for the cbo, I have a column count of 3, bound column of 1, & the column widths set to 0",2",1" - this way the review # doesn't show, just the name & date.
In the code, [Review_No] refers to the field in the table storing the review # - that's probably obvious, but didn't want to leave anything to guesswork for you!
Okay, so when I try to open the form, I get run-time error 2501 - and the line it's stopping on is
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
So, what obvious piece am I missing here????
Thanks!
I have a table - tblFaceSheet - stores the values that pull to a form. I also created qryFaceSheet for the data in the table.
I have a form for users to select which review they wish to edit - simple combo box (cboSelectCase) that has the review #, the case name, & the review date (I'm basing the cbo on the qry from the FaceSheet table). Review # is primary key, but they won't know that info - they'll need to see the name/date combo to pick the record they want to edit.
The "Go" button on the form with the combo box is supposed to open frmReviewEdit, & it's supposed to populate the form with the info from the table (or query - which is better to use?) based on the choice in the combo box. This must be the easiest, most obvious code in the world! But I'm getting a run-time error on it.
Here's the code:
Private Sub cmdEditReview_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmFaceSheetEdit"
stLinkCriteria = "[Review_No] ='" & cboSelectCase & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
DoCmd.RunCommand acCmdFilterByForm
DoCmd.Maximize
End Sub
On the form, for the cbo, I have a column count of 3, bound column of 1, & the column widths set to 0",2",1" - this way the review # doesn't show, just the name & date.
In the code, [Review_No] refers to the field in the table storing the review # - that's probably obvious, but didn't want to leave anything to guesswork for you!
Okay, so when I try to open the form, I get run-time error 2501 - and the line it's stopping on is
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
So, what obvious piece am I missing here????
Thanks!