Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    perryc is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2019
    Posts
    122
    would this help?

    SELECT Referrals.ID, Referrals.ReferralDate, Referrals.[A?P?R?], Referrals.Patient, Referrals.RefSource, Referrals.Zip, Referrals.Dx, Referrals.Payor, Referrals.[ACO?], Referrals.[SN?], Referrals.[PT?], Referrals.[OT?], Referrals.[ST?], Referrals.OtherServices, Referrals.ExpHHSOC, Referrals.ExpPTEval, Referrals.Comments, Referrals.[BSHSIDoc?], Referrals.[HighRefAcct?], Referrals.[OtherFactors?], Referrals.ID, Referrals.EnteredBy, Referrals.CaseComplete, Referrals.[RequestApproval?], [Zip&Team].City, [Zip&Team].Team, Referrals.T_Orange_Used, Referrals.T_Green_Used, Referrals.T_Blue_Used, Referrals.T_Red_Used, Referrals.T_Pink_Used, Referrals.[ToRequester:], Referrals.DOB, Referrals.M0102, Referrals.Attending, Referrals.InsSpecific, Referrals.DeclineReason, Referrals.Alert, Referrals.RcdUpdated, Referrals.ApprovalDT, Referrals.Approver, Referrals.IniEntryDT, Referrals.NN
    FROM Referrals INNER JOIN [Zip&Team] ON Referrals.Zip = [Zip&Team].Zip
    WHERE (((Referrals.[A?P?R?])<>"Cancelled" Or (Referrals.[A?P?R?]) Is Null) AND ((Referrals.CaseComplete)=False) AND ((Referrals.[RequestApproval?])=True))
    ORDER BY Referrals.ID, Referrals.ID;

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    If you want to provide db for analysis, follow instructions at bottom of my post.

    Advise not to use punctuation/special characters (underscore only exception) in naming convention.

    Your code is changing the RecordSource to an SQL statement that has only one table, not a query that joins tables to retrieve related info.

    Why set RecordSource? Why not just apply filter?

    DoCmd.OpenForm "Form1", , , PCriteria
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #18
    perryc is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2019
    Posts
    122
    Ajax, First, I am so thankful that you took all this time to help me. I am so sorry that I am not a programmer, therefore, my explanation is not the best. I can not upload the DB because I broke it into front and backend and it is too complicated to upload. Let me just explain once more my problem and I know what you are saying about why not just filter things.

    Form1 (recordsource is join between 2 tables with a common key "Zip"; Table1 is a patient referral info w/ a field called Zip and Table2 has 3 fields only: Zip, City and Team)
    When Form1 is displayed, the form calls for fields in Table1 plus City and Team from Table2 where Zip = Zip)
    Normally, display these info are fine. I can navigate from record to records in Form1 and Zip, City, and Team all displayed normally.
    The problem comes when I do a record search, by the following command from a search form:
    DoCmd.OpenForm "Form1"
    Form_Form1.RecordSource = "select * from Referrals where " & PCriteria
    All the data displays just fine except City and Team from Table2 will become #Name?

    Well, I think I hear what you are saying, perhaps, is by doing the codes above (Form_Form1.RecordSource...) I may have messed up the record. Instead, do:
    DoCmd.OpenForm "Form1", , , PCriteria to open the form directly?

    I will give it a try and report back. Thank you so much again.

  4. #19
    perryc is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2019
    Posts
    122
    Quote Originally Posted by June7 View Post
    If you want to provide db for analysis, follow instructions at bottom of my post.

    Advise not to use punctuation/special characters (underscore only exception) in naming convention.

    Your code is changing the RecordSource to an SQL statement that has only one table, not a query that joins tables to retrieve related info.

    Why set RecordSource? Why not just apply filter?

    DoCmd.OpenForm "Form1", , , PCriteria


    Ajax, You are a genius! Works great!! Not sure why it did not work if I search through the record source. Thanks a lot!!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 02-28-2018, 01:02 PM
  2. Replies: 6
    Last Post: 02-02-2015, 02:14 PM
  3. Replies: 12
    Last Post: 08-17-2013, 11:49 PM
  4. Replies: 6
    Last Post: 10-25-2012, 04:13 AM
  5. Replies: 3
    Last Post: 06-27-2009, 03:53 PM

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