Results 1 to 8 of 8
  1. #1
    LAazsx is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    30

    3 combo box to a single string

    Hi, I have three combo boxes which i will use for entering a date. mm/dd/yyyy. I've already made an entered their values but how do i combine them to a single string to be stored?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    try:
    Code:
    combo1 & combo2 & combo3
    or "/" in between if the combos are being used for each part of the date.

  3. #3
    LAazsx is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    30
    thanks. for the quick reply. i shall try it out later.

    EDIT: sorry but how do i use this?

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    that's vba code behind a form. when referring to controls, you don't have to use "me." as the qualifier.

    concatenation in vba is produced by the ampersand symbol. "&"

    so when you combine the values together, throw it wherever you want to, by whatever method, vba or not, that you want to.

  5. #5
    LAazsx is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    30
    So i should have something like this?

    vDate = combo1 & ,"/", & combo2 & ,"/", & combo3

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    NO.

    no commas sir, just the ampersands. e.g. -

    field1 = "1"
    field2 = "15"
    field3 = "2010"

    to get a date (each field is a combo box name):
    Code:
    myvariable = field1 & "/" & field2 & "/" & field3
    if you get a type mismatch error when you're doing it, you may have to use:
    Code:
    myvariable = cstr(field1) & "/" & cstr(field2) & "/" & cstr(field3)

  7. #7
    LAazsx is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    30
    i see. thank you for the correction.

  8. #8
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    you bet!

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

Similar Threads

  1. An expression to edit a single row
    By senghlim in forum Access
    Replies: 4
    Last Post: 10-29-2010, 01:20 PM
  2. Print Single Report
    By emkwan in forum Access
    Replies: 1
    Last Post: 01-29-2010, 11:19 AM
  3. Query to display in single row
    By access in forum Queries
    Replies: 10
    Last Post: 01-14-2010, 11:40 AM
  4. Single Record Reports (HELP)
    By bnckeye27 in forum Reports
    Replies: 1
    Last Post: 11-13-2009, 02:14 PM
  5. Adding a single record
    By kfoyil in forum Forms
    Replies: 2
    Last Post: 11-22-2006, 09:12 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