Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Posts
    38

    Unanswered: Emailing a single report

    So I have created a query to email a single report based on the data I have open in the form! problem is that when I click on the button to email the report it ask me what the Inbound_ID is I want that to be carried over for me how would I go about doing that????

    Ok so here is my query!

    SELECT Employees_Inbound_Query.Initials, Employees_Inbound_Query.Emp_First_Name, Employees_Inbound_Query.Emp_Last_Name, Employees_Inbound_Query.Inbound_ID, FROM Employees_Inbound_Query LEFT JOIN Employees_Soft_Skills_Inbound_Query ON Employees_Inbound_Query.Inbound_ID = Employees_Soft_Skills_Inbound_Query.Inbound_ID
    WHERE ((([Employees_Inbound_Query.Inbound_ID])=[ME]![Inbound_ID]));

    and here is my code

    Private Sub Email_Inbound_Report_Click()
    On Error GoTo Err_Email_Inbound_Report_Click

    Dim stDocName As String

    stDocName = "Email_Inbound_Report"

    DoCmd.SendObject acReport, stDocName

    Exit_Email_Inbound_Report_Click:
    Exit Sub

    Err_Email_Inbound_Report_Click:
    MsgBox Err.Description
    Resume Exit_Email_Inbound_Report_Click

    End Sub

    what ddo I need to change so that it doesnt ask me which inbound_ID everytime??

  2. #2
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Your query is referring to Me! but you use the query in the report!
    Instead of "[ME]![Inbound_ID]", you should use "Forms!FormName!Inbound_ID" so that the query knows that you are referring to the value on the form.
    (Of course, you must use the name of your form instead of "FormName")

  3. #3
    Join Date
    Jan 2004
    Posts
    38
    Ahh that totaly makes sense!

    Can you explain to me why it is bad to use * in querys???

  4. #4
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Originally posted by Crash1hd
    Ahh that totaly makes sense!

    Can you explain to me why it is bad to use * in querys???
    That's not bad at all.
    But you must use it wisely : a * in a query will normally be used in a condition :

    Like "New*"

    This condition will return all fields that begin with "New"

    And if this is your goal (getting all cities starting with 'New'), using a * is the only way to get it....

  5. #5
    Join Date
    Jan 2004
    Posts
    38
    Ahh ok I actually was wondering for the Select part you know Select * From or putting the actual variables you wish to select?

  6. #6
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Originally posted by Crash1hd
    Ahh ok I actually was wondering for the Select part you know Select * From or putting the actual variables you wish to select?
    Well, it's always taking less resources if you name the fields to be selected (SELECT FieldA, FieldC, FieldG FROM MyTable

    But you will not feel the difference if you use SELECT * FROM MyTable if that table is not too large.
    Ground rule : if you need more than half the fields, you can use the *.

  7. #7
    Join Date
    Jan 2004
    Posts
    38
    Ok Thats good to know!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •