Results 1 to 6 of 6
  1. #1
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105

    Combobox not filling

    Hi all, I have a bound combobox with 2 columns AccountID, AccountName, bound to column 1 and with rows set at 0",1".
    This works great on the form... I select the combobox and it fills with all the account names, when I save, the accountID is stored in the table... Just like I wanted!

    The issue I'm having is when I call the form from another form, I'm passing through AccountID from the calling form expecting that the combobox will then be pre-populated with the account info that was on the first form.
    i.e.


    Code:
    Dim strLinkCriteria As String
    strLinkCriteria = "[AccountID]=" & Forms!frmAccountDetail![AccountID]
    DoCmd.OpenForm "frmAccountContactJoin", , , strLinkCriteria
    However, when I call the form, the combobox (On frmAccountContactJoin) is not populated... what am I doing wrong?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Need to review data structure and form design. If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  3. #3
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    Attached is sample DB with everything I think is needed...

    It should open to a continuous form "sfrmAccountList"
    Double clicking the demo account in the account list will open an account detail form.
    Clicking the opportunities tab, there's a "New" button which will open the new Opportunity form.
    The new Opportunity form has the combobox "Account Name" which I would like to have pre-populated with the account ID from the Account Detail form that was calling it.

    FYI, I know that the tables are horrendous... I'm working with someone else's back-end and creating a new front end... then I will go back and re-do the back-end... but we're still using the old front end in production until I complete the new front end...

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why does Opporutinities tab disappear when cursor passes over? When I click it, the tab disappears and General tab shows. Both show a 'New' button. I find this confusing. I don't like and don't use Navigation form/control.

    Your original post refers to frmAccountContactJoin but now you say to look at frmOpportunityDetail?

    Okay, have the Opportunity form open. So you want to populate the AccountID field and initiate record. You are not passing the AccountID value by putting strLinkCriteria in the WHERE CONDITION argument, AccountID needs to be passed in the OpenArgs.

    DoCmd.OpenForm "frmOpportunityDetail", , , , acFormAdd, , Me.AccountID

    Then code in frmOpportunityDetail Current event:

    If Me.NewRecord Then Me.AccountID = Me.OpenArgs

    Remove tblAccounts_Vendors from the RecordSource. It doesn't appear to be needed and the INNER JOIN requires related records in both tables.
    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.

  5. #5
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    The disappearing tabs is because the theme did not transfer when I copied the form... it's not how it appears on the original database.
    I realize I spoke about a different form... I have several forms that exhibited this behavior, and this one seems most expedient for creating an example database from.

    I didn't realize I needed to use OpenArgs... I will test that method, thank you.

  6. #6
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    That works, thanks.

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

Similar Threads

  1. Replies: 1
    Last Post: 10-22-2014, 11:56 PM
  2. Replies: 5
    Last Post: 02-12-2014, 11:52 PM
  3. Problem filling textboxes from combobox
    By reidn in forum Forms
    Replies: 1
    Last Post: 06-23-2011, 05:06 PM
  4. Problemss filling textboxes from combobox
    By reidn in forum Programming
    Replies: 13
    Last Post: 06-23-2011, 01:48 PM
  5. Filling a combobox with field names.
    By millerdav99 in forum Access
    Replies: 1
    Last Post: 04-26-2011, 02:09 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