Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Your syntax looks okay to me.


    If you open the immediate window you can dynamically test the function by typing the following in;
    ?=ConcatRelated("OrderDate","Orders","CustomerID=1" )
    And see what it returns. Substitute 1 for an actual customer ID.

    For what it's worth I too would have pointed out about the cross posting had I spotted it.
    Many of us participate on more than one forum, and it's pretty irksome to find that you have spent time on providing an answer, to then get a response with a totally different train of thought involved/code, which has magically appeared from someone else's answer on another forum. We don't mind but it's polite to mention it, as someone may well repeat the advice already given elsewhere.

    As you will discover there are normally 3 or 4 ways to skin a cat in Access, and each persons preferred method differs, hence the frustration in the above situation.

  2. #17
    Ramtrap is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2016
    Posts
    62
    Hi, thanks for the reply!
    I'm not sure what you mean "immediate window"--are you talking about Opening up the "ConcatRelated" form and replacing the Control Source with "?=ConcatRelated("OrderDate","Orders","CustomerID=1" )"?
    That's what I did, and got errors with the question mark, and then tried multiple other ways to get it to work, to no improvement. I am still getting a #Name? error.

    To walk you through my line of thinking and how I understand it, it goes like this:

    =ConcatRelated("OrderDate", "Orders", "CustomerID=2000")


    =ConcatRelated( This starts to call the function ConcatRelated()
    "OrderDate", This is telling the function that I want to identify fields named OrderDate
    "Orders", This is telling the function that I want to pull the field above from the Orders table
    "CusomerID=2000") This is telling the function to only fill in the textbox with data if the CustomerID number is 2000 (which is a valid Customer ID, as he has 3 orders (image below), and then it ends the function as I'm not going for the optional ORDER BY or SEPARATOR.

    If the above is correct, then I've got no clue as to why it's not working properly.

    As far as the cross-posting, I do understand that now. It would have been more tactful for me to point out that I had posted it elsewhere; that is 100% duly noted and will definitely do that, should I ever do so in the future. My issue was in the tact that it was given to me, in that a simple message to me, "Hey, here's a post about cross-posting; would you mind letting others know that you have it posted on Forum X, too?" is all that would have been necessary for me to have my "Oh crap, I'm sorry!" moment. It was nothing intentional when it was posted for anyone to waste time, and again, now that I know the community's feelings on that, I have no problems with doing that, I just thought it was a little rude how it was initially addressed. It's like yelling at a child; they didn't know what they were doing was harmful or wrong, but a little corrective action, taking them aside, that's helpful, rather than yelling at them in the Walmart in front of everyone--if that makes any sense, lol.

    I really do appreciate your, and everyone's, help with this, though. And the computer isn't crashing when I add images now, so added bonus!
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	7 
Size:	14.8 KB 
ID:	31185
    Last edited by Ramtrap; 11-09-2017 at 09:00 AM. Reason: Added image

  3. #18
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Not a problem.

    The immediate window is in the VBA editor. Press Alt+F11 to get to it. Then press Ctrl+G to open the immediate window.
    ? means print the result. SO it a great way to check functions and syntax things if you are unsure - so for instance see how to to get the first day of a the current month simply type
    ? DateSerial(Year(date), Month(date), 1)
    So to check your function
    ?ConcatRelated("OrderDate", "Orders", "CustomerID=2000")

  4. #19
    Ramtrap is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2016
    Posts
    62
    That's awesome! This is really helpful, thank you! I didn't know about the Immediate window.

    I did what you said, and got it to work, and I get the DateSerial example; that works fine. However, the ConcatRelated is giving me a compile error: "Expected variable or procedure, not module"

  5. #20
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Did you by any chance save the module you created with ConcatRelated in it with the name of ConcatRelated?
    You shouldn't have Access won't like it. Delete the module, and recreate it but call it something like modBasicFunctions. Then all will be sunny in the world.

    Possibly

  6. #21
    Ramtrap is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2016
    Posts
    62
    I wish I could give you a million likes/approves to this! I got all that working now, and just gotta figure a way to take what you taught me and apply it to my db. Thank you so very much!!!

    For anyone that may come across the issue (and it may seem obvious to those with more Access/VBA knowledge), if you name the module you create the same as any table or form, you're going to get errors. Thanks again!!

  7. #22
    Ramtrap is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2016
    Posts
    62
    I apologize for my ignorance, but is there a way to mark this post as Solved?
    Last edited by Ramtrap; 11-09-2017 at 10:04 AM. Reason: Spelling error

  8. #23
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    According to the link at the top of the page https://www.accessforums.net/showthread.php?t=1828

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Add Multiple Values To A Textbox
    By vazdajic in forum Programming
    Replies: 3
    Last Post: 06-06-2017, 07:24 AM
  2. Retrieving Multiple Values into a Single Field
    By Simbiose in forum Queries
    Replies: 6
    Last Post: 08-23-2016, 07:54 AM
  3. Multiple Values in textbox
    By frksdf in forum Forms
    Replies: 10
    Last Post: 07-14-2014, 11:41 AM
  4. Replies: 7
    Last Post: 06-04-2013, 01:10 PM
  5. Replies: 1
    Last Post: 12-04-2011, 06:33 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