-----Original Message-----
The command button code follows:
************ begin code ********************
Private Sub btnEditClosedJob_Click()
On Error GoTo Err_btnEditClosedJob_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm2VE Main"
stLinkCriteria = "[InvNum]=" & Me![InvNum]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnEditClosedJob_Click:
Exit Sub
Err_btnEditClosedJob_Click:
MsgBox Err.Description
Resume Exit_btnEditClosedJob_Click
End Sub
************* end code *********************
The form "frm2VE Main" (VE=View Edit)is normally used for
editing a job record. Open jobs are available for the
viewed client; user selects from among those jobs, via a
combo box, to edit a job record. (The combo box selects
[cboInvNum] and the linking field is [InvNum] displayed
on the form.) This method displays the selected job
record for the viewed client correctly. Once the job is
closed I set a closed field to true; its no longer
viewable as an open job, only as a closed job -- via a
job history form, "frm2V Main" (V=view only). These forms
show very similar data in very different ways.
On occasion it is necessary to edit a closed job. The
command button (using code above) is on the "frm2V Main"
form. I set the closed field to false (they all are set
false now for testing, hence no code for that yet), and
the code opens "frm2VE Main". This returns only header &
footer -- complete with empty fields/buttons, etc, and a
blank body -- nothing in it, not even blank fields,
buttons, etc.
I surely do hope someone sees the problem. As stated,
when I substitute another form that is tied to [InvNum],
receipts data for example, it works ok. The failure is
here with this form. (I think!)
Put a breakpoint on the DoCmd.OpenForm line, and check the value of stLi
nkCriteria, to make sure it's getting the correct value of InvNum. But
I wonder if perhaps the recordsource of [frm2VE Main] selects only
records for open jobs, so if you try to call it for a closed job, no
record is found. And since the form doesn't allow edits ort additions,
the form's detail section is blank.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.