Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518

    Here's where VBA would go:

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    pmangan is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    21
    Quote Originally Posted by Bulzie View Post
    in your doctors table and combo box you have a field for their Location right?
    I only have the Location's primary key in the DoctorT

    Quote Originally Posted by Bulzie View Post
    Then in the AfterUpdate of the Location field on the form, you put me.Doctor.Requery.
    This is the part I think I'm doing wrong. I just keep getting errors saying "Access cannot find the object 'me.'". Not sure if this has something to do with Access2016 or if I'm just doing something wrong. Is there a requery expression I can build?

  3. #18
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    is Doctor the name of the combo box? Both combo boxes(Locaation and Doctor) are on the same form right?

    Also if you are not familiar with the build option, it is great at giving you the correct syntax to use for forms, fields, options, etc. Open your main form in design, now open a query(new or existing), in the criteria box of a column, right click and select Build, double click Forms, double click Loaded Forms, double click your form(subform also), you wll see fields and options show up. If you double click on a field, at the top it will show you the full path to that field that you can use in your code. You can also see on the right all the properties you can choose or double click also.

  4. #19
    pmangan is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    21
    SOLVED:
    Thanks to pbaldy and Bulzie for all the help and guidance. I was able to get everything working by doing the following
    Added Lookup Column field (LocationLookup) to populate the Location that the user wants from LocationT.LocationName. This field also contains the other columns which the user will need to see. On the Property Sheet, I set the Column Count to the number of columns I added and changed the Column Widths to 0" for all but the LocationName. I then added text boxes for the rest of the columns I wanted displayed using function "=LocationLookup.column(x)".
    Added Combo Box field (DoctorLookup) to populate the Doctors which relate to the selected location from DoctorT.DoctorName. Added additional columns as noted above in LocationLookup.
    In order to get the DoctorLookup combo box to only display the doctors at a given location I set a criteria for DoctorT.LocationID (autonumber from LocationT) field to [PatientT].[LocationID]. I then added the requery to the After Update event at the LocationLookup in order to update the query based on the selected location.
    This requery popped my VBA cherry: Me.DoctorLookup.Requery

    Doing all this I was able to accomplish everything I was looking to. Big thanks again to the members in this forum.

    One sort of strange issue arose as a result of all this though. Now when I filter any column on the split form I get an error "The method you tried to invoke on an object failed". The filter works fine after I hit "OK" but it's still strange that the error is getting thrown. I do not get the error in the table, only the form. I've done a little research on what causes this but no luck yet.

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

Similar Threads

  1. Shortening if / dlookup >0 / then dlookup
    By Jack Russel in forum Modules
    Replies: 1
    Last Post: 02-19-2016, 03:01 PM
  2. DLookup
    By Alex Motilal in forum Programming
    Replies: 2
    Last Post: 04-20-2015, 11:05 PM
  3. Like in Dlookup
    By msp4422 in forum Programming
    Replies: 3
    Last Post: 02-19-2013, 04:02 PM
  4. DlookUp
    By cap.zadi in forum Forms
    Replies: 5
    Last Post: 09-21-2011, 07:16 PM
  5. Is DLookUp What I should be using?
    By cameronaziz in forum Forms
    Replies: 2
    Last Post: 03-24-2011, 04:29 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