Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add column to Access 97 in vb.net

Status
Not open for further replies.

wrzek

Programmer
Aug 29, 2005
12
PL
Hello,

I want to add new column to my Access 97 table:
Code:
fTable = fCatalog.Tables("tbQualityData")
fTable.Columns.Append("MyCol", ADOX.DataTypeEnum.adCurrency)
fTable.Columns("MyCol").Properties("Default").Value = 2
It works, but next I want to change the Access property of MyCol column: "Format" to "Fixed" and "Decimal Places" to 2.

I know how to do it directly in Access 97, but how i can do it in vb.net code?

Thank You in advance for any suggestions,
Larry
 
Virtually the same way. First you must set a reference to ADODB, then copy and paste your code inside the procedure that you want.

If there are any errors, VS will underline the errors. The only thing I see off from .Net is the ADOX. ADOX can be used, but the preferred way it ADODB.

Once your code is in place, if there are any errors, simply use the object browser (F2) to find out the syntax and possible object change.

I hope this helps.



Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Mayby i asked a wrong question... i'll try one more...

I want to set such parameters:
but from VB.NET code.

I know how to set "Defaul Value" in VB.NET:
fTable.Columns("MyCol").Properties("Default").Value = 1

But i don't know how to set "Format" or "Decimal Places" in VB.NET. I tried something like this:
fTable.Columns("MyCol").Properties("Format").Value = "Fixed"
or
fTable.Columns("MyCol").Format = ...
But there is no such properties...

Thank You in advance,
Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top