Hi guys,
I'm trying to have txtBox1 display: ([first 20 characters of COMBOBOX1], [Name], [Date])
How do i pull the first 20 characters of the combobox value, and also what is the appropriate syntax for actually concatenating it?
Thank you all!
Hi guys,
I'm trying to have txtBox1 display: ([first 20 characters of COMBOBOX1], [Name], [Date])
How do i pull the first 20 characters of the combobox value, and also what is the appropriate syntax for actually concatenating it?
Thank you all!
Left([combobox1,20) & ", " & [Name] & ", " & [Date]
More about string functions: http://msdn.microsoft.com/en-us/library/dd789093.aspx
Name and Date are reserved words. Should not use reserved words as names.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks June7, I was using those field names as examples, I know that![]()
Getting #Name? error :\
Where does the bracket go for the combobox in the SQL you gave?
Oh I know why, My data column is in Column 2 in the comboBox, how would I add that to the SQL?
What is the actual value of the combobox? Is it a multi-column combobox? Which column do you want the 20 characters from?
EDIT: Didn't see your last posts
Reference columns by index. Index begins with zero
[combobox1].[Column](1)
Rats! Access query object won't recognize the Column reference.
Exactly what are you trying to do?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Well, I have a form with the combobox and other two text boxes, My boss would like a simple way to have them concatenated for a copy and paste.
Only using it for copy and paste, I wont be calling it again, So is there anyway in VBA to make a temp var and add on each value from the cbobox and then add the two text boxes, and then for the actual new textbox, just set it equal to the temp var?
I would have no idea how to do that, but its just some food for thought.
Why did you ask about SQL?
Copy/paste from where to where?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Well my boss wants to copy the concatenation and then use it either in an email or something, I'm not exactly sure, I just know he wants those 3 things combined in one text box to be able to copy them all at once, so that he can then paste it wherever he needs to. I'm just trying to follow directions is all![]()
Hi -
I think this :
[combobox1].[Column](1)
should be this:
[combobox1].Column(1)
Remove square brackets off Column, so you would have something like this:
Left([combobox1].column(1), 20) & ", " & [Name] & ", " & [Date]
John
Last edited by John_G; 08-01-2014 at 01:25 PM. Reason: add information
The concatenation expression referencing Column index should work in a textbox ControlSource. Access will throw in the [] around Column even if you don't type them. VBA won't. I know, weird!
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
This is what I'm using and I'm getting the #Name?
[Left([cboPlanName].[Collumn(1),20)]]
Ive also tried
[Left([cboPlanName].[Collumn](1),20)]
Ive also tried
[Left([cboPlanName].Collumn(1),20)]
None of those have worked :\
This is the right one: [Left([cboPlanName].Collumn(1),20)]
but Column only has 1 "l" in it, and don't enclose the whole thing in square brackets:
me!textboxname = Left([cboPlanName].Column(1),20) & .... other data
John
Try:
Left([cboPlanName].[Column](1),20)
precede with = if you are using this as the Control Source of a text box
= Left([cboPlanName].[Column](1),20)
EDIT
Sorry John. My typing is clearly a bit slow.
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
Thank you guys, I got it working now!