Results 1 to 7 of 7
  1. #1
    henricirc is offline Novice
    Windows 7 Access 2003
    Join Date
    Aug 2010
    Posts
    1

    Form to show query results and generate reports of these results.


    not sure if this is possible but here it goes...

    I want to be able to use text box(txtsearch) in a form called pickpatients to fill in the parameter and run a query (PatientQuery1) to search patients by last name. Then, take the results of that query and display in a listbox on the form. Finally, select a result from the list box press a cmdbutton and display the result information in a report.

    I know this is a lot. I have access 2003. I designed the query which works great. The way my form is now, when i open the form the query parameter box opens and not the form (not a big deal), then the listbox displays the results of the first query. I am stuck here because when I run subsequent searches when the form is open(by clicking cmdsearch) the query results are displayed in a separate query window rather than the listbox. The report viewing completely baffles me. PLEASE HELP!!!

    Heres the row source of the listbox:
    SELECT [PatientQuery1].[Patient ID], [PatientQuery1].[Medical Records ID], [PatientQuery1].[Last Name], [PatientQuery1].[First Name], [PatientQuery1].[Sex], [PatientQuery1].[Diagnosis Code 1], [PatientQuery1].[Date of Visit] FROM PatientQuery1 ORDER BY [Patient ID];

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    There is a question that I have why does your form open with the parameter box. Is it Recordsource is a conditional query.

    I have done the folowing
    I have table member
    I have have made a form using it table1
    I have created a Query Query1 with the fllowing criteria to the member_id field :
    Forms!table1!Text0

    Text0 is the TextBox in which i type my member Id which is used as the criteria for the Query1 member_id

    I have a list Box List0 the RowSource of which is is Query1.

    I then attache this code to the afterupdate event of the Text0
    Me.List0.Requery

    Now when I open form table1 the List box is blank, but when I type an ID number in Text0 and press enter the list box Displays the Name and the ID Number

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    check the form table1. Type an Id number like 1 or 2. press enter see the Id and name being displayed in listbox

  4. #4
    Dwright05 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Apr 2012
    Posts
    1
    I know this is an old post but this was exactly what I was looking for and it helped great. But I also wanted to be able to click on one of the results and then open the original form that was used to enter the data. Therefore I can edit that record.
    I have tried a bunch of stuff and right now I'm pretty lost, any help would be great.

    thanks

  5. #5
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Hi, Dwright05. Welcome to the forums.

    Try adding a button in the Detail section of the form and use the code below. This should pop up the form you want to edit in based off of the record you want. Obviously, replace your information with the temporary form and record names.

    DoCmd.OpenForm "youredittingformnamehere", , , "[YourID]='" & Me!YourID & "'"

  6. #6
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Hi

    Is this possible. After it display the results in the form, i would like for my user to be able to make changes to the data and updated it.


    Thank you

  7. #7
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Ray,

    After your results display in your form, you will need to create a second form to edit whatever data you want. Call the form using the code I posted, and you should be able to update the data.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Display Query Results on a Form
    By P5C768 in forum Queries
    Replies: 5
    Last Post: 05-04-2010, 11:04 AM
  2. display query results in a form
    By P5C768 in forum Queries
    Replies: 3
    Last Post: 08-14-2009, 03:02 PM
  3. Restricting Results In Reports
    By Hawkx1 in forum Reports
    Replies: 0
    Last Post: 06-24-2008, 09:53 AM
  4. Entering query results in a form
    By marcello.dolcini in forum Forms
    Replies: 0
    Last Post: 04-15-2007, 06:01 PM
  5. Export Access reports/query results to Outlook Calendar/Task
    By kfinpgh in forum Import/Export Data
    Replies: 0
    Last Post: 02-22-2007, 01:09 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums