OpenForm doesn't work

nectar

New member
Local time
Today, 16:58
Joined
Sep 16, 2003
Messages
8
Hello all,

I've a form "FormCurtain" which contains a subform listing the different size of the curtains.

When I try to open the Subform with the following code (from a search form) it doesn't work. It opens the corresponding form but doesn't move to the right record.

Dim strDocID As String
Dim strLinkCriteria As String

strDocID = Me!ByNbr_Nbr

strLinkCriteria = "ID = '" + CStr(strDocID) + "'"
DoCmd.OpenForm "FormCurtain", , , strLinkCriteria


If I try with a more simple form, i.e. without a subform I don't have any problems...

Any idea? Thanks in advance!!
nectar
 
Last edited:
Unfortunately, it is not that easy when trying to search through a subform's records. The method you described works fine with a main form but not so well with a subform on a main form. The easiest way to do this is to filter the recordset at query level, using a parameter query taking the parameter from the search box. The downside of this is that it will only show a limited recordset, not 'find' the record amongs the entire recordset.
 
Thanks Fizzio,

Could you just help me with "filter the recordset at query level", please?

Where do I have to filter it?? Within the code of my button? at a onOpen event in the form I open??

TIA
 
The problem of implementing this is that it is more difficult to reshow the entire recordset which could be a problem. It might be easier if I try to knock up an example for you. I'll get onto it as soon as I can.
 
Very nice!! Thanks in advance

Fizzio said:
The problem of implementing this is that it is more difficult to reshow the entire recordset which could be a problem. It might be easier if I try to knock up an example for you. I'll get onto it as soon as I can.
 

Users who are viewing this thread

Back
Top Bottom