Can't get Report to show data from records based on a Form's Combo Box choice.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ahmed Andaleeb
    New Member
    • Dec 2010
    • 3

    Can't get Report to show data from records based on a Form's Combo Box choice.

    I am completely new to access programming let alone VB. But I got pretty far with some help from the main programmer.. However I'm trying to introduce a new feature to the database which is basically this:

    1) Make selection of "Symptom" from the "Patient" table via Combo box on the form.

    2) Click a button on the form to open the report "Patient PD Report" showing details of all recorded patients with that "Symptom"

    AND THE CODE I USED IS:
    Code:
    DoCmd.OpenReport "Patient PD Report", acViewPreview, , "[Symptom] = '" & Me.PD & "'"


    Yet for some reason after making a selection and clicking the button to execute the code, I keep getting a blank report. Can I add any details to make my predicament clearer?? Please help me! The deadline for demonstration is not far away :P!
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    What is the Record Source for the Report?

    Comment

    • Ahmed Andaleeb
      New Member
      • Dec 2010
      • 3

      #3
      Nevermind ADezii, lol I found out what the issue was. I got the function working properly thru a minor change (Conceptual :P!) See I had used the code:
      Code:
      SELECT [Patient.RN], [Patient].[Symptom] FROM [Patient] ORDER BY [Patient].[RN]

      To make the combo box "PD" show a list of values from the field "Symptom" in the table "Patient". And I'm guessing the reason why the code in the OP didn't work is because "Symptom" wasn't the linked field via Relationships in the database, and I don't think it should be because the data type isn't unique for every record.. Right? (YES! Total NOOBness..!).

      So I simply had to change the OP code to:
      Code:
      DoCmd.OpenReport "Patient PD Report", acViewPreview, , "[RN] = '" & Me.PD & "'"

      Thnaks for replying anyways, I have literally tons of other things I'm hoping to be able to do with this awesome software, who knows where I might go. This almost feels like a new addiction waiting to happen :)!

      If any1 is willing to help me out here (PLZ!), I have a few ideas I need to figure out how to actually do:

      1) Make Form text/background colour change once a check-box on the form is selected. Then make a 'Save' or 'Confirm Changes' button which will do exactly that and then lock the Form from any further editing. Maybe even to be unlocked with a password if needed.

      2) Make a Report with just one box showing ALL the values recorded under a field. AS in not separated into consecutive rows/columns by each record, but rather displayed like the words in this post. With each field entry displayed from every record separated by just a comma.

      3) Actually learn how/when/where to successfully use the "Lookup" command. And eventually build my 1st Filter/Search functions & searchable forms.

      I could go on.. lol :P! And yes, I'll look up any useful links. Please help a newbie programmer out. Thanks!

      Comment

      • Moah Scout
        New Member
        • Oct 2010
        • 58

        #4
        My friend, you are talking too much!
        Be straight to the point, brief as much as possible and includes all details of what exactly you are looking 4!
        You may not get enough reponse otherwise

        Comment

        • Ahmed Andaleeb
          New Member
          • Dec 2010
          • 3

          #5
          I am SO sorry for not posting a concise message. Basically I have managed to get the issue solved myself. I kind of forgot the nature of this website, I've never actually participated in forums of this nature or programming for that matter lol, took it as one of those threads at IMDb etc hehe. I should have started separate threads for separate questions for Access. Thanks for replying & pointing this out Moah Scout lol :P!

          Comment

          Working...