Maize para pakar Excel mohon bantuannya permasalahannya adalah perintah ( rst.Fields.Append adt, adNumeric ) pada kode dibawah tidak bisa menambah kolom pada database Access
sudilah kiranya para pakar membantu menyelesaikan permasalahan ini
terimakasih
Private Sub Cmd_Out_Click()
Dim upDt As String, adDt As String, b As Long
a = 0
b = 0
Set rst = New ADODB.Recordset
sDBCon = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ThisWorkbook.Path & "\db1.mdb" & ";"
Set db = New ADODB.Connection
db.Open sDBCon
rst.Open "OUT", db
rst.MoveFirst
While Not rst.EOF
If InStr(LCase$(Trim$(rst.Fields("PN").Value)),
LCase$(Trim$(Cmb_Part.Value))) Then
For Each Rsk In rst.Fields
If InStr(LCase$(Trim$(Rsk.Name)), LCase$(Trim$(txt_tgl.Value))) Then
b = 1
upDt = "Update OUT SET " & Rsk.Name & " = '" & txt_Out.Value & "' WHERE
PN='" & Cmb_Part.Value & "'"
db.Execute upDt
MsgBox "kolom ada " & upDt
Exit For
Else
b = 0
End If
' db.Execute "Update OUT " & _
"SET 09_Nov_11 = " & _
"'20'" & _
" WHERE PN=" & _
"'7034-1306'" '& ";"
Next Rsk
a = a + 1
MsgBox "baris ada"
End If
rst.MoveNext
Wend
If b = 0 Then
adDt = txt_tgl.Value
rst.Fields.Append adt, adNumeric
upDt = "Update OUT SET " & txt_Out.Value & " = '" & txt_Out.Value & "'
WHERE PN=" & Cmb_Part.Value & ";"
db.Execute upDt
MsgBox "kolom baru saja di tambah"
End If
If a = 0 Then
MsgBox "Boz data belum ada lhooo", vbInformation
' lbl_database.Visible = True
End If
db.Close
Set db = Nothing
Set rst = Nothing
Set Rsk = Nothing
End Sub
Terimakasih
Best Regard
<>.<>.<>.<>.<>.<>.
sidoel<<amaizrul.gif>>
<<Maize Bkgrd.jpg>>

