Results 1 to 14 of 14
  1. #1
    MikeEmerald is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Posts
    13

    Question Combo box changing text box values

    Hi all,

    Brand new to learning Access and im just after a quick help to get me started for most of what i need.

    I have a table with the two following columns (Raw Material / CAS No)
    In a form i currently have a combo box that has it's row source as
    SELECT [Raw Material].[ID], [Raw Material].[Raw Material] FROM [Raw Material];
    I then have a text box for the CAS No that i want to update to show the Cas for the selected raw material in the combo box.

    Any help would be grand.



    Thanks so much,

    Mike

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    What other data is going on the form?

    Pull all of these into a query in design mode then use

    Code:
    =cboRawMaterials.value
    as the criteria

  3. #3
    MikeEmerald is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Posts
    13
    Click image for larger version. 

Name:	Untitled.jpg 
Views:	13 
Size:	117.5 KB 
ID:	27559

    Hi Andy, thanks for replying. I'm really new to all this so i have attached a picture for me to understand your answer better.

    I set up the query but seem to be stuck getting the combo box and text box's sorted.

    Thanks for the help.

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

    try and create another combo box but see if it has three options at the beginning. One would be something like "find a record on my form based on the value I choose in my combobox"

  5. #5
    MikeEmerald is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Posts
    13
    No, just the normal two options available when i create another combo box

  6. #6
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Does your form have any data being fed into it? Could you post a copy of your database online?

    (Go advanced and zip it first?)

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

    Look for the on_change event of the combobox you are using and copy and paste the following code

    Replace ComboName with the actual name of the Combo Box

    All you need is:

    Code:
    Me.Filter = "ID = " & Me.ComboName
     Me.FilterOn = True

  8. #8
    MikeEmerald is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Posts
    13
    I can't upload because of works network restrictions. I will try to be more descriptive with my issues.

    Please see pictures.

    So my query works fine, it feeds the raw material into the raw material combo box on the form, however when i switch between test material 1 and test material 2 in the combo box, i would like the Cas No. text box to update with the cas no pulled from the query.

    Is there something i need to put in the text box properties, a macro or something.

    Thanks for paitence Click image for larger version. 

Name:	Untitled.jpg 
Views:	13 
Size:	79.3 KB 
ID:	27560

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

    Happy to help

  10. #10
    MikeEmerald is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Posts
    13
    Andy, think you was trying to solve different problem? My combo box works fine in selecting the material from the query, it just doesnt update the text box with the CAS No. for the selection.

  11. #11
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Not at all Mike. Can you tell me if your form has a record source.

    (in design mode go into properties of the form. It should be the top one)

    And what is the control source of the textbox Cas No

  12. #12
    MikeEmerald is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Posts
    13
    No record source and there is no source for the text box

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

    Do you have a table (or query) with all the details you need on the form including casNo.

    If not, make one

  14. #14
    MikeEmerald is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2017
    Posts
    13
    Thanks for your help Andy, managed to sort it +rep

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

Similar Threads

  1. Changing Formatting of Text Values - Accounting Format
    By accessnewbie352 in forum Forms
    Replies: 10
    Last Post: 01-09-2015, 04:42 PM
  2. Replies: 10
    Last Post: 12-15-2013, 11:52 AM
  3. Hve text combo box values but store integers in field
    By accesshelpasker in forum Access
    Replies: 9
    Last Post: 10-28-2011, 10:49 AM
  4. Replies: 10
    Last Post: 07-02-2011, 11:51 AM
  5. Replies: 3
    Last Post: 08-11-2009, 10:40 AM

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