473,473 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using codes to create Database Table

32 New Member
I use Ms Access 2000 for my Database Tables.
I tried to use code to create a Database Table for the Tax Software I am developing instead of creating it manually.
Initially I wrote each field on a separate line. But when I wrote above 10 lines VB complained that the statement should not exceed 10 lines so, I then wrote this statement :

Dim conPaye As ADODB.Connection

Set conPaye = New ADODB.Connection
conPaye.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source='C:\BIRS6\Tax.mdb'"

conPaye.Execute "CREATE TABLE Paye(" & _
"AssessmentYear Date Number(6),TaxPayerID Smallint(10),Name VarChar(50),Address varchar(50),TownVillage varchar(50),State varchar(50), " & _
"BasicSalary Currency,HousingAllowance Currency,TravellingAllowance Cuurency,UtilityAllowance Currency,MealSubsidyAllowance Currency,EntertainmentAllowance Currency,LeaveGrant Currency,OtherAllowances Currency,TotalAllowances currency,GrossPay Currency, " & _
"PersonalAllowance Currency,ChildrenAllowance Currency,DependantRelativesAllowance Currency,HousingReliefAllowance Currency,TransportReliefAllowance currency,UtilityReliefAllowance Currency,MealSubsidyReliefAllowance Currency,EntertainmentReliefAllowance Currency, " & _
"LifeAssurancePolicy Currency,LeaveGrantReliefAllowance Currency,DisabilityAllowance currency,PensionFund Currency,NationalHousingFund Currency,GrossTaxFreePay Currency,TaxablePay Currency,AnnualTaxPayable Currency,MonthlyTaxPayable Currency);"

Set conPaye = Nothing
End Sub

After writing the above statement I receive this compile error:

'Syntax Error in CREATE TABLE statement'.

I tried several times to detect my mistake but could not.Please kindly point out what is wrong with the above code.
Thank you in advance.
Akinyemi.
Jan 12 '07 #1
3 3629
willakawill
1,646 Top Contributor
I use Ms Access 2000 for my Database Tables.
I tried to use code to create a Database Table for the Tax Software I am developing instead of creating it manually.
Initially I wrote each field on a separate line. But when I wrote above 10 lines VB complained that the statement should not exceed 10 lines so, I then wrote this statement :

Dim conPaye As ADODB.Connection

Set conPaye = New ADODB.Connection
conPaye.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source='C:\BIRS6\Tax.mdb'"

conPaye.Execute "CREATE TABLE Paye(" & _
"AssessmentYear Date Number(6),TaxPayerID Smallint(10),Name VarChar(50),Address varchar(50),TownVillage varchar(50),State varchar(50), " & _
"BasicSalary Currency,HousingAllowance Currency,TravellingAllowance Cuurency,UtilityAllowance Currency,MealSubsidyAllowance Currency,EntertainmentAllowance Currency,LeaveGrant Currency,OtherAllowances Currency,TotalAllowances currency,GrossPay Currency, " & _
"PersonalAllowance Currency,ChildrenAllowance Currency,DependantRelativesAllowance Currency,HousingReliefAllowance Currency,TransportReliefAllowance currency,UtilityReliefAllowance Currency,MealSubsidyReliefAllowance Currency,EntertainmentReliefAllowance Currency, " & _
"LifeAssurancePolicy Currency,LeaveGrantReliefAllowance Currency,DisabilityAllowance currency,PensionFund Currency,NationalHousingFund Currency,GrossTaxFreePay Currency,TaxablePay Currency,AnnualTaxPayable Currency,MonthlyTaxPayable Currency);"

Set conPaye = Nothing
End Sub

After writing the above statement I receive this compile error:

'Syntax Error in CREATE TABLE statement'.

I tried several times to detect my mistake but could not.Please kindly point out what is wrong with the above code.
Thank you in advance.
Akinyemi.
Hi. In this part of your statement:
Expand|Select|Wrap|Line Numbers
  1. AssessmentYear Date Number(6),TaxPayerID Smallint(10),Name VarChar(50),Address varchar(50),TownVillage varchar(50),State varchar(50), " & _
  2. "BasicSalary Currency,HousingAllowance Currency,TravellingAllowance Cuurency,UtilityAllowance Currency,MealSubsidyAllowance 
You have you have a spelling error with currency and can you tell me what the data type is for AssessmentYear?
Jan 12 '07 #2
Akinyemi
32 New Member
Thanks for your interest in helping me.

In Nigerian tax system, Assessment is based on Calender year: 2005 Assessment Year; 2006 Assessment Year etc.
The user of my tax software is expected to enter in the Assessment Year Textbox "2005" or "2006" . In 2007 the user will be expected to enter 2007 in the Assessment year textbox. That is how our tax system is.

I used Integer. It didn't work. Then I used Number. Yet it didn't work.

Thank you.

Akinyemi
Jan 13 '07 #3
Killer42
8,435 Recognized Expert Expert
I'm not familiar with the CREATE TABLE statement, but if the syntax for each field is name followed by type, then "AssessmentYear Date Number(6)" doesn't seem right. If the field name has a space in it, don't you need square brackets around it, or something?
Jan 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Rathtap | last post by:
I want to use the Identity field (increment 1,1) as a primary key and have a unique constraint on my other field which is of type char. I am worried that related data in other tables may lose...
4
by: Barry Edmund Wright | last post by:
I would really appreciate your assistance. I am using Access 2000 to create a form that Lists Names and Addresses based on a number of selection criteria one of which is a combo box cboPCZip. All...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
8
by: PW | last post by:
Hi, There is code in Alison Balter's excellant "Mastering Access 2003" to create a list of error codes and descriptions but it only generates error messages 3 through 94. Is there a website...
1
by: bimeldip | last post by:
Hi, I have managed to create codes to display data from the database in a html page.I have gone on to create a page to allow users to manipulate the table via a html page. For instance users will be...
0
by: bimeldip | last post by:
Hi, I have managed to create codes to display data from the database in a html page.I have gone on to create a page to allow users to manipulate the table via a html page. For instance users will be...
1
by: gomathinayagam | last post by:
hai, am only beginer in c#... i am trying to connect database with webform. using a technique that the fields of the table and the controls in a form are named same...then i try get the controls...
1
George Lft
by: George Lft | last post by:
ok, first of all, i built my register page using dreamweaver tool which the codes haven been out of control. Now i'm thinking that turning over everything - by using this another set of codes. And...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.