Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    May 2001
    Location
    Mount Vernon, Washington, USA
    Posts
    305
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Field Relationships

    In my transaction table, when I choose a certain product ID I want the appropriate Unit Price for that product to be the default in the Unit Price field in that table. How can I do this?
    lynndelap

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Field Relationships

    You can't update one table field based on another in the same table. However, you can do this in a form by using a combobox for the ProductID. The combobox, which we'll call cboProduct for this purpose, has 2 columns, the ProductID and the Unit Price. In the AfterUpdate event of the cboProduct, you set the txtUnitPrice control equal to the second column of the combobox like this:

    <pre>Private Sub cboProduct_AfterUpdate()
    Me!txtUnitPrice = Me!cboProduct.Column(1)
    End Sub</pre>


    By doing it that way instead of setting txtUnitPrice's control source to "=[cboProduct].[Column](2)", you leave txtUnitPrice editable so that the user can override the default value.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    May 2001
    Location
    Mount Vernon, Washington, USA
    Posts
    305
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field Relationships

    Thanks so much! This can be so frustrating. I only took one course through Skillpath and am now trying to build a unique Inventory Database for our company. I am not a Math person either! Will give this a try. <img src=/S/brainwash.gif border=0 alt=brainwash width=15 height=15>
    lynndelap

Posting Permissions

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