Select record

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ditch
    New Member
    • Oct 2006
    • 12

    #1

    Select record

    Hi

    I am using the following code, and basically what I want it to do is this:

    User selects a Business Unit from drop down list, they then click on a button and it creates a report based on the the business unit selected from the drop down list.

    It converts the reoprt to RTF and then fires up a new email, but it picks the first change champion form the table and not the query from the drop down list, any ideas

    Dim stDocName As String
    Dim stMailList As String
    Dim stCCMailList As String
    Dim stHeader As String
    Dim stMessageBody As String
    Dim stSROD As Date
    stDocName = "Rpt Deployment Feedback"
    stMailList = "steve duncan"
    While TempStore <> Me.[Business Unit Name]
    DoCmd.GoToRecor d , , acNext
    Wend
    stCCMailList = Me.[Change Champion]
    stSROD = Me![Scheduled Roll out date]
    stHeader = "XP Phase2 Feedback Form: " & Trim(Me![Business Unit Name]) & " : " & stSROD
    stMessageBody = "Please see attached XP Phase 2 Feedback Form, could you complete and return. " & Chr(10)
    stMessageBody = stMessageBody & stSROD & " in Business Unit: " & Trim(Me![Business Unit Name]) & "." & Chr(10) & Chr(10)
    DoCmd.SendObjec t acSendReport, stDocName, acFormatRTF, stMailList, stCCMailList, "", stHeader, stMessageBody, False
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Hi,

    Where is this code placed? As a bouton ina Form maybe?

    It gats the information of your combo and from other fields in your form with the current record information!

    PLS check your Record Source of your Report that you send!

    Maybe it's your table NOT?

    Comment

    • ditch
      New Member
      • Oct 2006
      • 12

      #3
      The code is based on a button on the form and I have doubled checked the record source, it definatley comes from a query and not the table.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        I don't see anywhere in your code that specifies that the report should filter its output.
        If this filter is defined in one of the properties of the report itself, then that is relevant information and we need to see it to be able to help.

        Comment

        • PEB
          Recognized Expert Top Contributor
          • Aug 2006
          • 1418

          #5
          Is your query referenced to your Combo box?

          ie in the criteria of your query written somewhere:

          =Forms!Form1!Co mbo

          ?

          Originally posted by ditch
          The code is based on a button on the form and I have doubled checked the record source, it definatley comes from a query and not the table.

          Comment

          • MMcCarthy
            Recognized Expert MVP
            • Aug 2006
            • 14387

            #6
            While TempStore <> Me.[Business Unit Name]
            DoCmd.GoToRecor d , , acNext
            Wend


            Looking at your code above. Is TempStore the aforementioned combobox

            If it is..

            When you manually go though the records using the navigation buttons is it holding its value.

            Based on this code it seems as if the TempStore is an unbound combo box and on the same form as the records.

            Please correct me if I'm wrong. If this is the case there is a better way of doing it.

            Comment

            Working...