question
question
question
question
question
question question question question question question question question
question question
question
Go Back  Xtreme Visual Basic Talk > > > question


Reply
 
Thread Tools Display Modes
  #21  
Old 12-18-2003, 12:26 PM
Optikal's Avatar
Optikalquestion Optikal is offline
Codeaholic

Retired Leader
* Guru *
 
Join Date: Oct 2002
Location: Winnipeg, MB, Canada
Posts: 4,543
Default


that will probably work too, but I've never done ADOX stuff so I was just giving him the way I know...take your pick, both methods should work fine.
__________________
There are 10 types of people in this world, those that understand binary, and those that don't.
Reply With Quote
  #22  
Old 01-12-2004, 08:24 PM
NetProtocal NetProtocal is offline
Newcomer
 
Join Date: Jan 2004
Posts: 3
Default This worked for me

Public Function CreateAccessDatabase( _
ByVal DatabaseFullPath As String) As Boolean
Dim bAns As Boolean
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim col As New ADOX.Column

Try


'Make sure the folder
'provided in the path exists. If file name w/o path
'is specified, the database will be created in your
'application folder.

Dim sCreateString As String
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabaseFullPath
cat.Create(sCreateString)

tbl.Name = "NewTable"
col.Name = "DateField"
col.Type = ADOX.DataTypeEnum.adDate
tbl.Columns.Append(col)
col = New ADOX.Column
col.Name = "Address2"
col.Type = ADOX.DataTypeEnum.adVarWChar
col.DefinedSize = 20
col.Attributes = ADOX.ColumnAttributesEnum.adColNullable
tbl.Columns.Append(col)
col = New ADOX.Column
col.Name = "Age"
col.Type = ADOX.DataTypeEnum.adInteger
col.Attributes = ADOX.ColumnAttributesEnum.adColNullable
tbl.Columns.Append(col)
cat.Tables.Append(tbl)

cat.Tables("NewTable").Columns("Address2").Properties("Jet OLEDB:Allow Zero Length").Value = True

bAns = True

Catch Excep As System.Runtime.InteropServices.COMException
bAns = False
'do whatever else you need to do here, log,
'msgbox etc.
Finally
cat = Nothing
tbl = Nothing
col = Nothing
End Try
Return bAns
'DEMO
' If CreateAccessDatabase("F:\test.mdb") = True Then
' MsgBox("Database Created")
' Else
' MsgBox("Database Creation Failed")
' End If
End Function
Reply With Quote
  #23  
Old 01-13-2004, 06:39 AM
theberzerker69 theberzerker69 is offline
Centurion
 
Join Date: Dec 2003
Posts: 148
Default it

it doesnt like "Return bAns"
Reply With Quote
  #24  
Old 01-13-2004, 04:00 PM
NetProtocal NetProtocal is offline
Newcomer
 
Join Date: Jan 2004
Posts: 3
Question

What was the error you get. Im currently using the same code in an application.
Reply With Quote
  #25  
Old 01-14-2004, 06:56 AM
theberzerker69 theberzerker69 is offline
Centurion
 
Join Date: Dec 2003
Posts: 148
Default

in the code window, the text is underlined with squiggley lines and when I put the mouse over it, it says: "'Return' statement in a sub or a set cannot return a value"
Reply With Quote
  #26  
Old 01-14-2004, 07:23 AM
reboot's Avatar
rebootquestion reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,614
Default

You can't return a value from a Sub. Make it a Function if you need to return something.
Reply With Quote
  #27  
Old 01-14-2004, 09:18 PM
NetProtocal NetProtocal is offline
Newcomer
 
Join Date: Jan 2004
Posts: 3
Default

Reboot is Right. I used a function for mine.

Make sure you make it a Public Function
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Next Question in Database WhIsPeRs Database and Reporting 5 06-29-2003 05:45 PM
VB Question falcon1 File I/O and Registry 27 06-27-2003 02:21 PM
Back button zukester General 31 08-15-2001 12:05 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
question
question
question question
question
question
question question question question question question question
question
question
 
question
question
 
-->