Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Late Bind LinkMasterFields after main form opens


Message #1 by "Michael Mitchell" <michael@m...> on Fri, 28 Feb 2003 16:21:33
I have a form based on a stored procedure and a subform based on a 
differnet stored procedure.

When I open the form they are all unbound, then I open a an input box and 
ask for a search value that I then pass on as a parameter in my stored 
procedures.  

It all works when I use the entire value, but when I use a partial value 
with the "%" as in "B00%" instead of "B00400" my main form shows all the 
records that meet that, but I get no records on the subform.

I think it is because I have no child and master properties set, but when 
I try to presetn them or late bind them I still don't get any.

'***Main form stuff***
Me.InputParameters = "@myInput=" & "'" & MyValue & "'"
Me.RecordSource = "dbo.spElements"
'***Main form stuff***


'****Sub form stuff ******
Forms![F_Elements]![subF_ElementDetail].LinkChildFields = "ELEMENT_NO"
Forms![F_Elements]![subF_ElementDetail].LinkMasterFields = "ELEMENT_NO"
     '**I have tried switching the order of these as well.
Forms![F_Elements]![subF_ElementDetail].Form.InputParameters 
= "@myInput2=" & "'" & MyValue & "'"
Forms![F_Elements]![subF_ElementDetail].Form.RecordSource 
= "dbo.spElementDetail"
Message #2 by "Gregory Serrano" <SerranoG@m...> on Fri, 28 Feb 2003 16:30:14
Michael,

<< When I open the form they are all unbound, then I open a an input box 
and ask for a search value that I then pass on as a parameter in my stored 
procedures.  

It all works when I use the entire value, but when I use a partial value 
with the "%" as in "B00%" instead of "B00400" my main form shows all the 
records that meet that, but I get no records on the subform. >>

I believe input boxes are very literal and if you put something in there 
using wildcards (i.e. *, %, and/or ?) it takes them literally.  If you 
want partial values like "B00*" instead of "B00" what you have to do is 
accept the "B00" alone (no wildcards) and in your code say something like:

   Forms![F_Elements]![subF_ElementDetail].Form.InputParameters = _
   "@myInput2 Like '*" & MyValue & "*'"

instead of

   Forms![F_Elements]![subF_ElementDetail].Form.InputParameters = _
   "@myInput2=" & "'" & MyValue & "'"


Greg

  Return to Index