Query results shown on form

  • Thread starter Thread starter Bongard
  • Start date Start date
B

Bongard

Hi, I have a form that has a few criteria to be passed to my query
"qry_EditMVCF". My goal is to allow the user to type in criteria to
the fields into the form header - click a button and have the query
result displayed in the detail of the form. The reason for displaying
the records in a form is that I need to be able to track who makes
what changes to the table and if I have the users entering data in a
form I can append their userID to any records that they modify.

The fields of my query are [Source] [Node] [EffDate] [RecType]
[Amount] [UserID]
I have filters on the form header labeled [SourceF] [NodeF] [EffDateF]
[RecTypeF] [AmountF] & [UserIDF]

Would I use VB to create the SQL and pass it to the detail once the
user clicks on the button to run the query or what would be the
easiest way to do this? I have been trying for awhile and can't seem
to get it figured out. I have also contemplated creating a subform or
possibly even having a second form open when the button is pushed.

Thanks a lot for your help!
Brian
 
Hi,

strSQL = "SELECT [Source], [Node], [EffDate], [RecType],
[Amount], [UserID] FROM qry_EditMVCF WHERE Source = '" & Me.SourceF & "' AND
Node = '" & Me.NodeF & "' AND etc etc etc""

Me.RecordSource = strSQL

If your form is bound to another table or has to access other records than
those meeting your search criteria then you will need to use a subform whose
recordsource contains the above strSQL rather than using Me.RecordSource.

hth

TonyT..
 
I can try that thanks for the suggestion. Where do I put the
"me.recordsource = strsql" and where do I put the strSQL = ...

Thanks,
Brian
 
Best bet would proabaly be to create a Button on the form header and then use
the OnClick event procedure

TonyT..
 
Back
Top