VB & Access

Posted on 2005-03-10
Medium Priority
Last Modified: 2010-05-02
i am trying to create a table in access through vb... i have the following and i get a runtime error stating that my syntax is incorrect.  Anyone know what wrong?

strTableName = "VDealerH-" & Format(Now, "yyyymmdd")
strSql = "Create Table " & "" & strTableName & " " & "(DLR_NUM int, DLR_NAME Text, DLR_ADDR int)"

conn.Execute (strSql)

code looks like this :
Create Table VDealerH-20050310 (DLR_NUM int, DLR_NAME Text, DLR_ADDR int)
Question by:JoannieJefferson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 53

Accepted Solution

Ryan Chong earned 1000 total points
ID: 13507653
try use branket instead, like:

strTableName = " [VDealerH-" & Format(Now, "yyyymmdd") & "] "
strSql = "Create Table " & strTableName & " " & "(DLR_NUM int, DLR_NAME Text, DLR_ADDR int)"

conn.Execute (strSql)

see if this works?

Author Comment

ID: 13507750
You are wonderful. Thanks!

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question