OpenForm w/ where clause issue

C

Craig Buchanan

I am trying to open a form and display a single record. I the 'search'
form, I use the command:

DoCmd.OpenForm "frmIncident", , , "Id=" & Me.Incidents.Value

When I look at the code, Me.Incidents.Value is populated correctly.

The form I want to filter, frmIncident, opens, but only displays the new
record, not the one that is being specified by the where clause.

The issue seems to be with the frmIncident form, as other forms open as
expected. For the life of me, I can't seem to determine what setting is
causing the problem.

Does anyone have a suggestion?

Thanks.

Craig
 
D

Dirk Goldgar

Craig Buchanan said:
I am trying to open a form and display a single record. I the
'search' form, I use the command:

DoCmd.OpenForm "frmIncident", , , "Id=" & Me.Incidents.Value

When I look at the code, Me.Incidents.Value is populated correctly.

The form I want to filter, frmIncident, opens, but only displays the
new record, not the one that is being specified by the where clause.

The issue seems to be with the frmIncident form, as other forms open
as expected. For the life of me, I can't seem to determine what
setting is causing the problem.

Does anyone have a suggestion?

Thanks.

Craig

Could it be that frmIncident has its Data Entry property set to Yes?
That will force the form to open with all existing records hidden, only
allowing the addition of new records.

If this is the problem, you can either change the property setting of
the form (on the Data tab of its property sheet in design view) or you
can temporarily override the property setting for just this call to open
it:

DoCmd.OpenForm "frmIncident", , , _
"Id=" & Me.Incidents.Value, acFormEdit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top