Problem migrating from AccessXP to Access2003

J

Joop

Hi All,

In an application I developed on Access XP I have a parentform with a
subform. In the parentform I use the standerd filter option from the menu to
find a record. In the current event I make shure that the available records
in the childform match the record in the parentform.

The code in the current event is straight forward:

Private Sub Form_Current()
On Error Resume Next
Form_FrmContactpersonen.AllowFilters = True
Form_FrmContactpersonen.Filter = "FldBedrID = " &
Form_FrmBedrijven!FldBedrID & ""
Form_FrmContactpersonen.FilterOn = True
Form_FrmContactpersonen.Refresh
Form_FrmContactpersonen.Repaint
On Error GoTo 0
End Sub

The Form_FrmContactpersonen is the childform.
This works ok in Access XP. In Access 2003 the code stops with an error:
2448, You can't assign a value to this object.
This error occurs on every line where I want to change a property of
Form_FrmContactpersonen.
When I apply the filter from the menu, when the childwindow is active, it
executes ok

Does anybody know why that is?
Does anybody have a solution?

regards Joop
 
A

Allen Browne

In place of
Form_FrmContactpersonen
try:
Me.FrmContactpersonen.Form

It might be easier to just include FldBedrID in the LinkMasterFields and
LinkChildFields properties of the subform. No code needed, and you won't hit
the bug where Access gets confused if the main form and subform are both
filtered. Details:
http://members.iinet.net.au/~allenbrowne/bug-02.html

The alternative would be to build a SQL string, and assign to the
RecordSource property of the form in the subform control. (Check Access does
not automagiclly assign something to LinkMasterFields and LinkChildFields if
you do this.)
 

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