empty form, blonde moment?

  • Thread starter Thread starter Chrissy
  • Start date Start date
C

Chrissy

A command button (using wizard) returns an empty form. If
I substitute another form that uses the same link fields,
I do get results as expected. With correct form, no
records returned.

Why does this form not return records?

I successfully use the form elsewhere (combo box selects
desired record).

Is this a blonde moment, and easy fix, or something I
need to search out?

Thanks,
Chrissy
 
Chrissy,
It would be impossible to say without knowing more about what you are trying
to do. What is your command button supposed to do? What is the code behind
it? What is the recordsource for the form?

Get back to us with those answers and someone here can see if they can
figure out what's up.
 
Chrissy said:
A command button (using wizard) returns an empty form. If
I substitute another form that uses the same link fields,
I do get results as expected. With correct form, no
records returned.

Why does this form not return records?

I successfully use the form elsewhere (combo box selects
desired record).

Is this a blonde moment, and easy fix, or something I
need to search out?

Thanks,
Chrissy

It sounds like maybe the form's Data Entry property is set to Yes.
That's on the Data tab of the form's property sheet in design view. If
Data Entry is Yes, all existing records are hidden and the form serves
only to add new ones.
 
Thanks. Both the calling form and the called form are set
to NO.

See response below. Thanks.
 
Chrissy said:
Thanks. Both the calling form and the called form are set
to NO.

See response below. Thanks.

Hmm. Make sure that the code for the command button that opens the form
doesn't open it with the acFormAdd argument. Also, check to see if that
code applies a WhereCondition argument that filters out all the records
that would otherwise be displayed. Check the form after it has been
opened to see if it's currently being filtered. If it is, remove the
filter and see what you get. If that doesn't get you anywhere, check
the form's recordsource to see if it's a query that applies criteria
that aren't being met.
 
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!)

Thanks,
Chrissy
 
Chrissy said:
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.
 
It looks like the lack of additions/deletions did the
trick. Thanks.

-----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)


.
 
Back
Top