Results 1 to 8 of 8
  1. #1
    graccess is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    78

    Question Working with a subform control on the mainform

    I have this subform which displays several items from a combo box, depending on the record that has been chosen in the mainform, seems to update fine as I scroll through records. Two issues I'm having with this combobox control in the subform labeled '[RelatedName]'.

    If I try to clear my screen using a command button:

    On Error Resume Next Dim vntControl As Variant
    For Each vntControl In Me.Controls
    vntControl.Value = Null
    Next vntControl

    everything on the mainform clears except the data in the subform combobox.
    The other issue I'm having with this control is in an unbound textbox on my mainform that I'd like to use to display the current value from that same subform combo box.


    I've tried setting the control source on the textbox to =[Forms]![subfrmJUNCTIONcoev]![RelatedName] but I'm getting a #Name? displayed in that box. any suggestions what I should try?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See if this link helps a bit: http://access.mvps.org/access/forms/frm0031.htm

  3. #3
    graccess is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    78
    Quote Originally Posted by RuralGuy View Post
    I went through it but it's not bringing in the data I need. Not sure why. I've since made the main form control a text box since I really only need to retrieve one value from the subform combo box control. I was able to add a control source expression in my main form control : =[subfrmJUNCTIONcoev].[Form]![lbRelatedName]

    This at least retrievied the corresponding ID# to the selection I'm making in the subform. The subform is related to a table that could ultimately have hundreds of ID#s so I need to find a way to translate the number into text. I feel like I'm close. I wrote a query that would take that number and compare it to the ID to make that text available to me but i'm now getting lost in the weeds. The issue there might be that I'm not displaying that ID# as an integer after it reads the data from the combo box? Any other suggestions for me?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is the Combo Box bound to a field? Does it have a Control Source?

  5. #5
    graccess is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    78
    Yes. Bound to a companyID field in a company table. It displays names and the selection made there I want to ultimately use for grabbing other field data from its primary table and another table and displaying in text boxes on my main form. I think if I can grab the id#, I should be able to do the rest but the number that pops up in my text box is in text form.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try referencing Column(1) of the Combo Box.

  7. #7
    graccess is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    78
    Quote Originally Posted by RuralGuy View Post
    Try referencing Column(1) of the Combo Box.
    many thanks! simple and sweet. didn't occur to me that i had been referencing the wrong column all along. that fixed my issue perfectly.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Thanks for posting back with your success and glad we could help.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-07-2012, 05:31 PM
  2. Checkbox in mainform to control subform
    By revned12 in forum Forms
    Replies: 3
    Last Post: 09-09-2012, 02:32 AM
  3. Replies: 1
    Last Post: 06-15-2012, 05:08 AM
  4. Replies: 4
    Last Post: 03-30-2012, 01:47 AM
  5. Replies: 1
    Last Post: 11-29-2011, 01:37 AM

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