Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2009
    Posts
    4

    Unanswered: Combo box help for an oldie..

    I have used Access 97 a long time ago and was reasonably proficient, but my age is against me now. I have two tables:the first containing four fields and the other will have identical fields of the first table plus additional fields. I am trying to get combo box referencing the first(master table) automatically filling in four fields in the secondary table. If anybody is willing to point me in the right direction it would be much appreciated. I can post the basics of the database if required.
    Thank you in advance

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Odds are you shouldn't store the identical fields (other than the primary key field), but:

    Me.FieldName = Me.ComboName.Column(x)

    where x is the column containing the relevant data.
    Paul

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    What are the primary keys and foreign keys to these tables?

    Better post the other basics, it helps us help you

    Basically, you have a combo box that needs to look in table A at four fields and when one is selected, it populates four different fields. You could use VBA to populate the four fields in an AfterUpdate event for the combo box.

    VBA would be simple, something like the following (not 100% sure of the syntax right now):

    Code:
    Sub Form_AfterUpdate()
      Me.Fieldname1 = Me.ComboboxName.Column(0)
      Me.Fieldname2 = Me.ComboboxName.Column(1)
      Me.Fieldname3 = Me.ComboboxName.Column(2)
      Me.Fieldname4 = Me.ComboboxName.Column(3)
    End Sub
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Bah, sniper! lol
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Apr 2009
    Posts
    4
    Guys,
    Thanks for the replies. I have similar code, but I think there may be a problem with the field names being identical. I will rename the fields in the master table and see if that works. If still having no success, then I will post the file. It is pretty basic, but it will be developed from there.
    Thanks once again.

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Good luck!

    IF you have both sets of identically named fields in a form, then it does mess with their names, they become TableName.FieldName instead of just FieldName.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Apr 2009
    Posts
    4

    Tables and forms

    Guys,
    I have given up,I must be missing something obvious.I have started from scratch and am posting the file. I have included the tables and the two basic forms. Any help would be appreciated.
    Regards
    Attached Files Attached Files

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Sorry to be harsh here, but what is it you expect us to do? Do you want us to write a book containing all the instructions on how to do what you want or do you want us to design your database for you?

    I doubt anyone here would want to do either.

    First YOU put in your attempt at achieving your goal, using the advice that is already in this topic and when you get stuck, then post your situation, where you are stuck, perhaps along with the database at the point where you are stuck and then it should be easy to help you.... AND you will learn how to do it better than someone just doing it for you.

    BASIC steps:
    * Create a combo box to select the code, with the 5 fields of the master file in the combo box.
    * Look at post 3 and code your afterupdate for your combo box to populate the other 4 fields of the related table.

    There should be nothing else to do once you have done that. If you get stuck, ask away, even post your database again.

    HTH.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Apr 2009
    Posts
    4
    I must apologise in not including the four lines of code. StarTrekker you were not being harsh, and it was my fault for not including my attempts. I have never asked someone to do anything for me, just to get the job done. Knowledge only comes from attempting, failing and learning from ones mistakes. My skills range from pc repair, pc support, electronics both repair and installation, machining wood and metal, plumbing, electrical installation, building construction, etc.I have included the completed and working code to show that it has been sorted. I will now add the rest of the bits and make the form(s) pretty.
    Regards
    Attached Files Attached Files

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Awesome, just glad to see you got it sorted!

    I think I somehow misinterpreted your last post, I thought you gave up, chucked some basic forms together, uploaded it and expected step by step instructions or for someone to do it for you. My bad.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •