running a query in a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have put a control box on a form that runs a query. The query is to actually select the record that is open on the form, so that I can hit another control box that will generate a report based on the query and email the report. I can get the query to work in just the query menu, but not on the form. in the query menu it asks for the parameter, and when I enter it, it selects the proper record and displays the datasheet. Only I can't get to the form with the control button to email that record. When I select the control button on the form with a record open, I get a blank datasheet

Here is my query language:

SELECT [Bill Summary].[Bill Number], [Bill Summary].Hyperlink, [Bill Summary].Sponsor, [Bill Summary].Summary, [Bill Summary].Analysis, [Bill Summary].Backgroun
FROM [Bill Summary
WHERE [Bill Number]=forms!Bill_Summary!Bill_To_Email

Bill Summary is my table, Bill Number is the field that I want to use for the query, Bill_Summary is the form, and Bill_To_Email is the control box

Any ideas? Or do you know of a better way I can isolate one record in a table or form and email it
 
I can get the query to work in just the query menu, but not on the form. in the query menu it asks for the parameter, and when I enter it, it selects the proper record and displays the datasheet. Only I can't get to the form with the control button to email that record. When I select the control button on the form with a record open, I get a blank datasheet.

My guess is that you've newly entered a record on the form, and that
it has not yet been saved to disk. Try putting a line

If Me.Dirty = False Then Me.Dirty = True

before the OpenReport line in the code. This will force a write so
that the data exists in the table, available for the report.
 
Back
Top