Results 1 to 4 of 4
  1. #1
    Delta729 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2010
    Location
    Los Angeles
    Posts
    95

    My form is showing a primary key

    So, I'm trying to redesign my database and I'm having problems. In the form {frmRegVenPO} and in the top subform on the page named {fsubRegVenPO} (the subform with the label Vendor. There is only 1 piece of data, that being the vendor. However, it appears to be showing a primary key.




    I tried to change it to a combobox, and then that got all messed up for awhile. I'm back to where it appears to showing the primary key in a text box. (I had something like this happen the other day, but somehow I fixed that. However, I had trashed that db because I found that I was just not following good database practice, or at least to me it seemed that way.

    Can someone tell me how to fix this. It seems to something about changing the control source to show column 2. But whenever I try that, it just shows me an error. Any help would appreciated. Thanks.
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    all my forms show the primary key, do you not want it to show? If not, set it to invisible.

    if you want to load the data by having user pick a primary key, then the combo box of keys CANNOT have a control source (bound to a field, so you dont alter the record key)
    Once the combo box is unbound then user can pick a key, and load that record via AFTER UPDATE event:
    Code:
    Private Sub cboBox_AfterUpdate()
    If IsNull(cboBox) Then
      Me.FilterOn = False
    Else
         'if numeric
      Me.Filter = "[CompanyID]=" & cboBox 
         'if text
      'Me.Filter = "[CompanyID]='" & cboBox  & "'"
    
    
      Me.FilterOn = True
    End If
    End Sub

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    The numeric values are from the Vendor field. Replace them with names.

    If you are going to link these subforms on Vendor, there is no need for Vendor combobox.
    Same goes for Region combobox.
    Why even have these non-visible controls?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi

    I removed all of the Lookup fields from your tables.

    I added a table just to list the Vendors.

    I only looked at the relationships between the Regions - Vendors and PO

    In the Form that opens at startup you can do the following:-

    1. Select a Region
    2. Select a Vendor for that Region
    3 Add PO Number and Date

    Does this help?
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Replies: 13
    Last Post: 03-22-2019, 06:07 PM
  2. Replies: 9
    Last Post: 08-08-2016, 02:57 PM
  3. Replies: 5
    Last Post: 03-08-2016, 12:28 PM
  4. Replies: 6
    Last Post: 07-09-2015, 06:04 AM
  5. Replies: 1
    Last Post: 02-17-2012, 10:17 AM

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