Askeladden
Programmer
I need to create New Fields in Access using VB6.0. Is ther a way I might do this? If so, how?
Thanks ahead of time.
Thanks ahead of time.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim LinkFelt As Integer, i As Integer
LinkFelt = 1
For i = LinkFelt - 1 To lstDocs.ListCount - 1
datAccess.Recordset.Fields("Link", LinkFelt) = lstDocs.List(LinkFelt - 1)
LinkFelt = LinkFelt + 1
Next i
Private Sub LinkSave()
'Loop to save Listbox Arrays into named fields in, Access, record
Dim LinkFelt As Integer, i As Integer
Dim strSQL As Integer
LinkFelt = 1
For i = LinkFelt - 1 To lstDocs.ListCount - 1
'set SQL string
strSQL = "ALTER Table [Vedlikeholds Rutiner] ADD COLUMN Link" & LinkFelt & " Text(50)"
'To set and refresh datAccess
With datAccess
.RecordSource = strSQL
.Refresh
End With
'To Save an entry of the listbox into the newly created field
datAccess.Recordset.Fields("Link" & LinkFelt) = lstDocs.List(LinkFelt - 1)
LinkFelt = LinkFelt + 1
Next i
End Sub
Private Sub LinkSave()
'Loop to save Listbox Arrays into named fields in, Access, record
Dim LinkFelt As Integer, i As Integer
Dim strSQL As String
LinkFelt = 1
For i = LinkFelt - 1 To lstDocs.ListCount - 1
'set SQL string
strSQL = "ALTER Table [Vedlikeholds Rutiner] ADD COLUMN Link" & LinkFelt & " Text(50)"
'To set and refresh datAccess
With datAccess
.RecordSource = strSQL
.Refresh
End With
'To Save an entry of the listbox into the newly created field
datAccess.Recordset.Fields("Link" & LinkFelt) = lstDocs.List(LinkFelt - 1)
LinkFelt = LinkFelt + 1
Next i
End Sub
Dim Conn As ADODB.Connection
Conn.Execute strSQL
Conn.Execute strSQL
Dim conn As adodb.Connection
Dim i As Long
Dim sSql As String
For i = 1 To 10
sSql = "ALTER Table MyTable ADD COLUMN link" & i & " Text(50)"
conn.Execute sSql
Next i
conn.connectionstring = "someconectionstring"
conn.open
Conn.ConnectionString = "c:\IKDV\Vedlikeholds_Rutiner.mdb"
conn.open
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Password=;User ID=;" & _
"Data Source=c:\IKDV\Vedlikeholds_Rutiner.mdb;" & _
"Persist Security Info=True;"