Code:
Private Sub CMDPHOTO_Click()
With Cdlg
.FileName = ""
.Filter = "Image (*.jpg)|*.jpg"
.ShowOpen
If Len(.FileName) <> 0 Then
FN = .FileTitle
pathpic = .FileName
Image1.Picture = LoadPicture(.FileName)
End If
End With
End Sub
Private Sub cmdsave_Click()
Dim dt As String
Dim errflag As Boolean
Select Case toggle
Case 0:
dt = ""
dt = DTPicker1.Value
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
If pathpic <> "" Then
mstream.LoadFromFile pathpic
End If
ssql = "insert into Customer_table(customer_name,address,Phone_No1,Phone_No2,Email1,Email2,Profile,Docs,Reg_Date,Remarks,Pic,Pic_Name) values ('" & txtcustomername.Text & _
"', '" & txtaddress.Text & "','" & txtPhoneno1.Text & "','" & txtPhoneno2.Text & "','" & txtEmailid1.Text & "','" & txtEmailid2.Text & "','" & cmbProfile.Text & "','" & txtDocument.Text & "', '" & dt & "' ,'" & txtRemarks.Text & "','[B]" & mstream.Read &"' [/B],'" & FN & "')"
[B]conn.Execute (ssql)[/B]
MsgBox "New Record has been saved", vbInformation, "Confirmation"
Case 1:
ssql = "update customer_table set customer_name='" & txtcustomername.Text & "',address='" & txtaddress.Text & "', Phone_No1='" & txtPhoneno1.Text & _
"',Phone_No2='" & txtPhoneno2.Text & "',Email1='" & txtEmailid1.Text & "',Email2='" & txtEmailid2.Text & "',Profile='" & cmbProfile.Text & "',Docs='" & txtDocument.Text & "', Reg_Date= '" & dt & "' , Remarks= '" & txtRemarks.Text & "' where ID=" & TXTID.Text & ""
conn.Execute (ssql)
MsgBox "Existing Record has been updated", vbInformation, "Confirmation"
End Select
Call CMDENABLED(True, False, False, False, False)
Call txtenabled(True, False, False, False, False, False, False, False, False, False)
Call txtclear
Call listall
txtcustomername.Clear
Set rs = conn.Execute("select * from customer_table order by customer_name")
Do While Not rs.EOF
With txtcustomername
.AddItem rs!customer_name
End With
rs.MoveNext
Loop
End Sub
Comment