Results 1 to 7 of 7
  1. #1
    Robert2150 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Location
    Sparks, Nv
    Posts
    104

    Combo Box Lookup field blank.

    I have a main form which has a button to View one of the Reports related to my primary table.
    The View Report works fine.
    On close of the Report the program returns to the Main form, and it returns to the record of the Report that was viewed with all of the data for that record showing in all of the Fields, except the Combo Box that I use to look up a record, it is blank.


    Other than that, the Look Up Combo Box works fine.
    How do I get the Look Up Combo Box to show the information for that look up field.
    In the On Close item for the Report I have the following code to get back to the record I want to return to.

    Private Sub Report_Close()
    DoCmd.OpenForm "ENLARGED PROP INFO", , , "[Name]='" & Me![Name] & "'"
    End Sub

    Any suggestions?

    Hope this makes some sense.

    Robert2150

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    Under your open form command add a 2nd vba line and try to explicitly define its value i.e.
    Forms![Enlarged Prop Info].ComboBoxName = (whatever is the correct reference)

  3. #3
    Robert2150 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Location
    Sparks, Nv
    Posts
    104
    Would the correct reference be the name of the Field that is shown in the ComboBox?

  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,623
    What do you mean by 'Combo Box that I use to look up a record' - is this an UNBOUND combobox for input/selection of filter criteria?

    Is this form used for data entry/edit? Options for display the lookup that don't require VBA:

    1. another lookup combobox bound to field

    2. include the lookup table in the form RecordSource and bind textbox to the lookup alias field
    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
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    the field that the combo box is bound to - which is not necessarily the field that displays - - look at the combo box property to see its record source and which field it is bound to... typically it is bound to the first field and displays the second field but that can be changed...

    so your reference is perhaps: Me.[Name] since that is what you are using to open the field - but this is only correct if that aligns to the combo box's record source and bound field (also I should point out that 'Name' is a reserved word in the Application and so developers should avoid using it as table field names....but that may be too late in your case)

  6. #6
    Robert2150 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Location
    Sparks, Nv
    Posts
    104
    What I mean is that the Combo Box is a drop down that allows the user to select a record (by name). It is an Unbound combox.

    The main form is used for data entry, and editing.

    To include the lookup table in the form RecordSource do I add it to the field name? e.g FieldName_TableName.

    How do I "bind" textbox to the lookup alias field?

    Thank you for your help.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Including the lookup table in the form RecordSource means the RecordSource would be a query that joins tables. Do not use INNER JOIN.

    Bind textbox to a field by setting ControlSource property. Set it to the field from lookup table and prevent editing by setting properties Locked to Yes and TabStop to No.
    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.

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

Similar Threads

  1. Replies: 9
    Last Post: 01-13-2015, 07:30 AM
  2. Lock Value in Combo Box if Non-Blank
    By ErikAE in forum Forms
    Replies: 4
    Last Post: 08-29-2014, 11:23 PM
  3. Replies: 11
    Last Post: 11-28-2012, 04:29 PM
  4. Replies: 4
    Last Post: 05-11-2011, 03:06 AM
  5. Combo Box defaults to Blank
    By jimmonator in forum Forms
    Replies: 13
    Last Post: 05-02-2011, 01:28 PM

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