Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2013
    Location
    Melbourne
    Posts
    8

    Auto Text Insert In To A Blank Field In A Form


    Hi, I have a form with two fields, an unbound field and a combo box. The form is controlled by a query with two fields. Field 1 is named 'ID' and Field 2 is named 'Food'. I have line entries in field 2 as Meat, Fish, Chicken, Lamb, Duck etc and Line entries in field 1 as A1, A2, A3, A4, A6 etc each one of these ID's is against a food item. In the Form when I select Meat from the combo box... I would like the corresponding ID eg 'A1" to automatically pop in to the unbound field to save me having to scroll down and select from second combo box. Can I do this? thanks for your help.

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051

    Auto Text Insert In To A Blank Field In A Form

    The data source for textbox could be a dlookup

    Nz(dlookup(field1,query,"food=" & chr(34) & combobox.value & chr(34)"),"") or very similar


    Sent from my iPhone using Tapatalk

  3. #3
    Join Date
    Oct 2013
    Location
    Melbourne
    Posts
    8
    Thank you for your suggestion. I will give it a try tomorrow. Cheers

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Oct 2013
    Location
    Melbourne
    Posts
    8
    Hi, thank you for your previous reply.....I have visited your web site and tried your solution to "display related info from a combo box and save the result in a query based form". It keeps giving me a #Name? error in the form text box. I have tried the formula/spelling different ways but can't seem to crack it.

  6. #6
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    What have you got in there hector?


    Sent from my iPhone using Tapatalk

  7. #7
    Join Date
    Oct 2013
    Location
    Melbourne
    Posts
    8
    Exactly as you have given me

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Regarding your PM, what exactly did you put and where exactly? "Me" is only valid in VBA code, so it can't be in a macro or in the property sheet.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Regarding your PM:

    Sorry...

    Me.ID = Me.Category.Column(2)

    Is entered in The After Update line of the combo called.... Category

    This creates the error MS cant find the macro Me

    Thanks




    It sounds like you've entered the code directly in the properties window. It needs to go here:

    http://www.baldyweb.com/FirstVBA.htm

    You can respond here and I'll get an email. The PM system shouldn't be used for technical questions.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 12-02-2016, 02:57 AM
  2. Replies: 7
    Last Post: 04-15-2015, 09:14 AM
  3. Insert Field Value into MsgBox Text
    By jtm013 in forum Modules
    Replies: 4
    Last Post: 11-19-2014, 03:03 PM
  4. Replies: 4
    Last Post: 10-15-2012, 11:38 AM
  5. calculat text box and insert to field
    By barakkadosh in forum Access
    Replies: 3
    Last Post: 05-15-2012, 12:45 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