Results 1 to 3 of 3
  1. #1
    JenDambeck is offline Novice
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    2

    Combo Box and Mailing labels

    All I want is to print street addresses.

    I have all the data in one query called "Mailing Labels"


    with the field names:

    studentfirst
    studentlast
    parent1first
    parent1last
    streetaddress
    studentlist.townneeded.Value
    Zip

    When I create labels in access (with the button in the "Create" tab, the Control Source for each row if the label is:

    =Trim([studentfirst] & " " & [studentlast])
    streetaddress
    =Trim([studentlist.townneeded.Value] & ", NJ " & [Zip])

    It returns:

    John Doe
    123 Any Street
    4, NJ 08888

    Sooooo, "4" in the above output is the [cityID] primary key number if the [locations] table. In the table [studentlist] has a combo box for the field [townneeded] SO that is [studentlist.townneeded.Value] I want it to print "Bridgewater" so the USPS can deliver it. On the datasheet view of the query the names of the towns are there, but when I go through the wizard to make labels I get the number, not the town. Help?

    I know I can export the query as an excel file and mail merge from there to make labels, but I'm trying to teach myself about databases instead of using Excel all the time

    Thanks!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    1,607
    Sounds like you have table lookup for that field?
    If so make a query to get the data you want, and also remove the table lookups. They are not recommended.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?search_query=debug+access+vba



  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,047
    dont use .VALUE.
    if its a combo box beware of the BOUND COL.
    if bound col = 1 and your field is [ID] is in col 1 then you will get 4.
    you may want a different column cboBox.Column(2) to get the city. NOTE in vb code columns begin with zero, so cboBox.column(1) is actually column 2.

    I cycle thru a combo (or listbox) to load the screen using the combo ID, then print/email using field on the form since the combo box loaded them.
    when I choose combo item, it filters my record on the ID

    Code:
    sub cboBox_Afterupdate()
      me.filter = "[id]=" & me.cboBox
      me.filterOn = true
    end sub


    now my fields are: txtName, txtAddr, txtCity...etc

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

Similar Threads

  1. Mailing labels for spouses
    By bridgeo730 in forum Queries
    Replies: 13
    Last Post: 01-09-2018, 01:26 PM
  2. Mailing labels for 'no-email' records ONLY
    By Angeline in forum Queries
    Replies: 9
    Last Post: 06-25-2015, 02:13 PM
  3. Mailing labels formatting
    By Keith Sayers in forum Reports
    Replies: 11
    Last Post: 01-01-2013, 01:13 AM
  4. Centering Mailing Labels if line is Blank
    By shane201980 in forum Reports
    Replies: 4
    Last Post: 10-24-2012, 09:00 PM
  5. Mailing Labels from a Search Form
    By waltb in forum Access
    Replies: 4
    Last Post: 03-08-2012, 06:03 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