ZWSOFT User Community > ZWSOFT Forums - Find. Share. Connect. > ZWCAD > vba external database connectivity
vba external database connectivity
vba external database connectivity
18-12-2011 04:33 . am | View his/her posts only
Hello
I need to connect to MsACCESS databases from ZWCAD 2012. On page 362 of "Mastering ZWCAD I found the following:
You should purchase independent developed version of Visual Basic 6 providing ZWCAD VBA with extra components, such as external database engine and report forms compiling function.
I need a description of how to proceed. We have original VB 6.0 CDs.
Thank you
John
I need to connect to MsACCESS databases from ZWCAD 2012. On page 362 of "Mastering ZWCAD I found the following:
You should purchase independent developed version of Visual Basic 6 providing ZWCAD VBA with extra components, such as external database engine and report forms compiling function.
I need a description of how to proceed. We have original VB 6.0 CDs.
Thank you
John
vba external database connectivity
18-12-2011 05:31 . am | View his/her posts only
In an a attempt to answer to my own question I added a reference to MicroSoft DAO 3.6 Object Library (Menu,Tools,References...). The following code copies an empty MSACCESS database file to a new location, opens a text file and adds the contents of the text file to a table in the new database file.
code:
Private Sub CommandButton2_Click()
Dim wksObj As Workspace
Dim dbsObj As Database
Dim rstObj As Recordset
Dim dbsObj1 As Database
FileCopy "e:'John'AU-JHL1'AU-JHL2.mdb", "e:'John'AU-JHL1'temp.mdb"
Set dbsObj = DBEngine.Workspaces(0).OpenDatabase("e:'John'AU-JHL1'temp.mdb")
Set rstObj = dbsObj.OpenRecordset("tblcoorsJHL2", dbOpenTable)
Dim retCoord, v, v1 As Variant
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt|CSV Files (*.csv)|*.csv"
' Specify default filter.
CommonDialog1.FilterIndex = 2
CommonDialog1.DialogTitle = "Open Points File"
' Display the Open dialog box.
CommonDialog1.ShowOpen
' Call the open file procedure.
FileName$ = CommonDialog1.FileName
If Trim(FileName$) = "" Then
Exit Sub
End If
Open FileName$ For Input As #1
'separated by commas
Do
Input #1, ya$
Input #1, xa$
Input #1, za$
If OptionButtonAddMinus Then
za$ = Str(Val(za$) * -1)
End If
rstObj.AddNew
rstObj!yxdata = Val(ya$) * 100
rstObj!xxdata = Val(xa$) * 100
rstObj!zxdata = Val(za$) * 100
rstObj.Update
Loop Until EOF(1)
rstObj.Close
dbsObj.Close
Set dbsObj = Nothing
Set rstObj = Nothing
Close
UserForm1.Hide
ZoomExtents
UserForm1.Show
End Sub
code:
Private Sub CommandButton2_Click()
Dim wksObj As Workspace
Dim dbsObj As Database
Dim rstObj As Recordset
Dim dbsObj1 As Database
FileCopy "e:'John'AU-JHL1'AU-JHL2.mdb", "e:'John'AU-JHL1'temp.mdb"
Set dbsObj = DBEngine.Workspaces(0).OpenDatabase("e:'John'AU-JHL1'temp.mdb")
Set rstObj = dbsObj.OpenRecordset("tblcoorsJHL2", dbOpenTable)
Dim retCoord, v, v1 As Variant
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt|CSV Files (*.csv)|*.csv"
' Specify default filter.
CommonDialog1.FilterIndex = 2
CommonDialog1.DialogTitle = "Open Points File"
' Display the Open dialog box.
CommonDialog1.ShowOpen
' Call the open file procedure.
FileName$ = CommonDialog1.FileName
If Trim(FileName$) = "" Then
Exit Sub
End If
Open FileName$ For Input As #1
'separated by commas
Do
Input #1, ya$
Input #1, xa$
Input #1, za$
If OptionButtonAddMinus Then
za$ = Str(Val(za$) * -1)
End If
rstObj.AddNew
rstObj!yxdata = Val(ya$) * 100
rstObj!xxdata = Val(xa$) * 100
rstObj!zxdata = Val(za$) * 100
rstObj.Update
Loop Until EOF(1)
rstObj.Close
dbsObj.Close
Set dbsObj = Nothing
Set rstObj = Nothing
Close
UserForm1.Hide
ZoomExtents
UserForm1.Show
End Sub
vba external database connectivity
25-12-2011 08:31 . pm | View his/her posts only
30-12-2011 01:26 . am | View his/her posts only
Homecoming is also about a dance cheap
wedding dresses and games. One
should be comfortable in the pin up or updo hairstyles. Elaborate kinds require
practice so that one does not feel awkward while tilting the head or doing the
dance. If you had long hair last year, get into the wavy hairstyle with a
medium hair cut. Bobs are classy and much can be wedding
dresses done with stick-ons and
little wisps that frame your face.DCY



