Contradictory behavior

G

Guest

I have a form based on a query.

On the 'Form Open' event, based in some external information I set the
properties 'filter on' to true or false and 'filter' to spaces or a condition.

The form has the 'standard mode' set to 'continuous' (excuse me if property
names are not exactly as used in the english version. I'm Brazilian and use
the Portuguese Brazil version).

When the form shows and I have 'filter on' equal false and 'filter' equal
spaces, the records shown on the form are exclusively those existing in the
table.

When the form shows and I have 'filter on' equal true ans 'filter' equal
some parameter, appears a nullified record in adition to the records existing
in the table. I supose this is the record shown to add new records to the
table.

The form has the 'Allow delete' and 'Allow inserts' equal false and 'Allow
edit' euqal true.

How can I disable the null record to show?

Thanks in advance for any suggestions.
 
D

Dirk Goldgar

In
HomeroOM said:
I have a form based on a query.

On the 'Form Open' event, based in some external information I set the
properties 'filter on' to true or false and 'filter' to spaces or a
condition.

The form has the 'standard mode' set to 'continuous' (excuse me if
property names are not exactly as used in the english version. I'm
Brazilian and use the Portuguese Brazil version).

When the form shows and I have 'filter on' equal false and 'filter'
equal spaces, the records shown on the form are exclusively those
existing in the table.

When the form shows and I have 'filter on' equal true ans 'filter'
equal
some parameter, appears a nullified record in adition to the records
existing in the table. I supose this is the record shown to add new
records to the table.

The form has the 'Allow delete' and 'Allow inserts' equal false and
'Allow edit' euqal true.

How can I disable the null record to show?

Thanks in advance for any suggestions.

I can't reproduce this behavior. Please post the code you are using to
open the form, and the code in the form's Open event.
 
G

Guest

--
HomeroOM


Dirk Goldgar said:
In

I can't reproduce this behavior. Please post the code you are using to
open the form, and the code in the form's Open event.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Dirk

The code follows:

On a button:

DoCmd.OpenForm strForm, _
acNormal, _
, _
, _
acFormEdit, _
acDialog, _
strOpenArgs

OpenArgs is something like "Mesa=xx".

'Mesa' means table.

On the form's open event:

If IsNull(OpenArgs) = True Then

' If OpenArgs is Null, this means that the form was open directly,
' wich means that it was open in the forms menu in the database window.
' So we have to show all records

Me.FilterOn = False

Me.Filter = ""

Else

' If OpenArgs is not Null, this means that it was opened by an external
' invocation, e.g. by a form's button (our case).
' So we have to ativate and prepare the filter before exibition

strParm = OpenArgs


' ExtrairParm means ExtractParameter
' This function receives a keyword and the OpenArgs argument and
' returns a variant with the argument value.
' It's working OK so it doesn't matter to the problem
intMesa = ExtrairParm(strParmMesa, _
strParm)
Me.FilterOn = True

' Mesa is a key in the table associated with the form being opened
Me.Filter = "[Mesa] = " & _
intMesa

Me.Requery

End If

I think this is all that matters in this affair.

Thanks for your attention.

Homero
 
D

Dirk Goldgar

In
HomeroOM said:
The code follows:

On a button:

DoCmd.OpenForm strForm, _
acNormal, _
, _
, _
acFormEdit, _
acDialog, _
strOpenArgs

I think it's this line right here. When you specify acFormEdit for the
DataMode argument, you override the form's property settings. Try this:

DoCmd.OpenForm strForm, _
acNormal, _
, _
, _
, _
acDialog, _
strOpenArgs

Or, to make it simpler, this:

DoCmd.OpenForm strForm, _
WindowMode:=acDialog, _
OpenArgs:=strOpenArgs
 

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