Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2003, 10:36 AM
Authorized User
 
Join Date: Dec 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Concatenate 2 variables into one?

I would like to know if it is possible to concatenate 2 variables into one?

Example:

Dim strTbl As String
Dim strDate As String
Dim strNewTable As String
strDate = CStr(Date)
strTbl = Tbl
strNewTable = strTbl & strDate

My goal is to combine these two variables into one and name a table with the new concatenated variable.

Does anyone know how to accomplish this? I can already name a table with just a normal variable.

Thanks, Chester
 
Old December 9th, 2003, 01:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do you mean something like this:
Code:
SELECT Field1, Field2, [Field1] & [Field2] AS NewField
FROM YourTable;
Which is a simple select query, that can obviously be changed to an INSERT query.
 by putting
Code:
INTO NewTable
at the end

HTH

Steven



I am a loud man with a very large hat. This means I am in charge
 
Old December 9th, 2003, 10:27 AM
Authorized User
 
Join Date: Dec 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got what I need thanks :)

Example (in case anyone else ever needs it):
Dim strMonth As String
Dim strYear As String
Dim strMonthYear As String
strMonth = Month(Date)
strYear = Year(Date)
strMonth = Month(Date)
strYear = Year(Date)
strstrMonthYear=strYear & "_" & strMonth

Chester





Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate Rows stonesbg ASP.NET 2.0 Basics 5 February 6th, 2007 06:12 PM
Hyperlink (Concatenate) JEHalm Excel VBA 1 January 11th, 2006 01:09 PM
string concatenate phelkuizon Classic ASP Databases 1 September 13th, 2004 04:08 AM
concatenate with characters lily611 ADO.NET 1 July 21st, 2004 08:10 AM
Concatenate numbers fs22 Javascript 1 April 25th, 2004 06:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.