Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160

    Unanswered: Problems Concatenating w/date field

    Hello everyone.

    Could someone explain why this equation works without the date field, but not with it in?

    All_Field: [TextField1] & ("-"+[TextField2]) & ("-"+[TextField3]) & ("-"+[Date_Field1])

    I've put it in a query.

    thanks

    Marcus

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    the correct concatenation symbol is &
    VBA is very forgivign and will also use the + symbol. however when it finds a numeric value (date/column values are stored as numeric values) it tries to add the value

    so that should read

    All_Field: [TextField1] & ("-" & [TextField2]) & ("-" &[TextField3]) & ("-" & [Date_Field1])

    just a suggestion when trying to get help 'it works, but not with' doens't provide musg assistance
    far better to display what you are seeing and what any error messages are
    to help set a break point in the code block and step through till you find the error and reprint whats displayed
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160
    Hi healdem

    How do you create break points? It would be very useful for debugging. I might not have to spend half my life on this forum. ( to be fair I do enjoy it)


    "to help set a break point in the code block and step through till you find the error and reprint whats displayed"

    thanks for the help with the code. (I must say VB is not very forgiving with me...maybe because i'm cr@p at coding!!)

    cheers
    marcus

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Google

    on the of that
    ACC: Tips for Debugging Visual Basic for Applications Code
    may well be a best first read
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •