HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 3650 Views - Last Post: 11 June 2013 - 01:52 PM Rate Topic: -----

#1 bobykuriakose12  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 28-May 13

HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 28 May 2013 - 10:29 AM

Dear sir,

i am a student,i do one sample project in vb.6 and access 2003.i designed one form for students entry,name and address, etc,this details are saved in database and retrive in my choice.
but i have plan to insert student pictrue in my 'students entry form'.i have no idea about this picture insertation.can u please help me, how to insert pictrue,how to stored in database,how to retrive photo on my search command.

i also attached my source code,module source code and screen shot of form.

yours faithfully
boby kuriakose



----------------------------------SOURCE CODE ENTRY FORM---------------------------------

Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim i As Integer
Dim sngDailyRate As Single
Dim sngNumberOfDays As Integer
Dim sngHireCost As Single

Dim strLastName As String * 20
Dim strFirstName As String * 20
Dim s As String
Dim sql As String

Private Sub cmdadd_Click()
 cmddelete.Enabled = False
cmdadd.Enabled = True
cmdedit.Enabled = False
cmdsave.Enabled = True
cmdsearch.Enabled = True
 txtregno.Text = ""
  txtlearnearsno.Text = ""
   txtname.Text = ""
    txthousename.Text = ""
     txtaddress.Text = ""
     txtphoneno.Text = ""
     txtplace.Text = ""
     txtlclass.Text = ""
     txtos.Text = ""
chkss.Value = False
txtclamt.Text = ""

     dtpictestdate.Value = Date
    chkmcwtgr.Value = False
     chkmcwithoutgr.Value = False
    chklmv.Value = False
     chkmgv.Value = False
     chkmpv.Value = False
     chkhgv.Value = False
     chkhpv.Value = False
     chkthreewheel.Value = False
     chkautoric.Value = False
     txttotalfees.Text = "0"
     txtinstamt1.Text = "0"
   txtinstamt2.Text = "0"
    txtinstamt3.Text = "0"
     txtinstamt4.Text = "0"
     txtinstamt5.Text = "0"
     txtinstamt6.Text = "0"
     txtinstamt7.Text = "0"
     txtinstamt8.Text = "0"
     DTPmy.Value = Date
     DTPmy1.Value = Date
DTPmy2.Value = Date
DTPmy3.Value = Date
DTPmy4.Value = Date
DTPmy5.Value = Date
     DTPmy6.Value = Date
DTPmy7.Value = Date
DTPmy8.Value = Date
DTPmy9.Value = Date
DTPmy10.Value = Date
     DTPmy11.Value = Date
DTPmy12.Value = Date
DTPmy13.Value = Date
DTPmy14.Value = Date
DTPmy15.Value = Date
     DTPmy16.Value = Date
DTPmy17.Value = Date
DTPmy18.Value = Date
DTPmy19.Value = Date
DTPmy20.Value = Date
    DTPmy21.Value = Date
DTPmy22.Value = Date
DTPmy23.Value = Date
     DTPmy24.Value = Date
DTPmy25.Value = Date
DTPmy26.Value = Date
DTPmy27.Value = Date
DTPmy28.Value = Date
     DTPmy29.Value = Date
DTPmy30.Value = Date

     DTPinstdate1.Value = Date
     DTPinstdate2.Value = Date
    DTPinstdate3.Value = Date
    DTPinstdate4.Value = Date
     DTPinstdate5.Value = Date
   DTPinstdate6.Value = Date
     DTPinstdate7.Value = Date
     DTPinstdate8.Value = Date
     
     DTPlearfrom.Value = Date
     DTPlearto.Value = Date
     txtbalamt.Text = "0"
     sql = "select max(regno) as rn from studentdetails"
     If rs1.State Then
   rs1.Close
End If
    rs1.Open sql, cn, adOpenKeyset, adLockOptimistic
   If rs1.RecordCount = 0 Then
   txtregno.Text = "1"
   Else
   txtregno.Text = Int(rs1.Fields("rn")) + 1
   End If
   txtregno.Enabled = True
    txtlearnearsno.Enabled = True
    txtname.Enabled = True
    txthousename.Enabled = True
    txtaddress.Enabled = True
    txtplace.Enabled = True
    txtos.Enabled = True
txtclamt.Enabled = True
chkss.Enabled = True
    txtlclass.Enabled = True
    txtphoneno.Enabled = True
    dtpictestdate.Enabled = True
    chkmcwtgr.Enabled = True
    chkmcwithoutgr.Enabled = True
    chklmv.Enabled = True
    chkmgv.Enabled = True
    chkmpv.Enabled = True
    chkhgv.Enabled = True
    chkhpv.Enabled = True
    chkthreewheel.Enabled = True
    chkautoric.Enabled = True
    txttotalfees.Enabled = True
    DTPmy.Enabled = True
    DTPmy1.Enabled = True
DTPmy2.Enabled = True
DTPmy3.Enabled = True
DTPmy4.Enabled = True
DTPmy5.Enabled = True
    DTPmy6.Enabled = True
DTPmy7.Enabled = True
DTPmy8.Enabled = True
DTPmy9.Enabled = True
DTPmy10.Enabled = True
    DTPmy11.Enabled = True
DTPmy12.Enabled = True
DTPmy13.Enabled = True
DTPmy14.Enabled = True
DTPmy15.Enabled = True
    DTPmy16.Enabled = True
DTPmy17.Enabled = True
DTPmy18.Enabled = True
DTPmy19.Enabled = True
DTPmy20.Enabled = True
    DTPmy21.Enabled = True
DTPmy22.Enabled = True
DTPmy23.Enabled = True
    DTPmy24.Enabled = True
DTPmy25.Enabled = True
DTPmy26.Enabled = True
DTPmy27.Enabled = True
DTPmy28.Enabled = True
    DTPmy29.Enabled = True
DTPmy30.Enabled = True

    DTPinstdate1.Enabled = True
    DTPinstdate2.Enabled = True
    DTPinstdate3.Enabled = True
    DTPinstdate4.Enabled = True
    DTPinstdate5.Enabled = True
    DTPinstdate6.Enabled = True
    DTPinstdate7.Enabled = True
    DTPinstdate8.Enabled = True

    

    txtinstamt1.Enabled = True
    DTPinstdate1.Enabled = True
    txtinstamt2.Enabled = True
    DTPinstdate2.Enabled = True
    txtinstamt3.Enabled = True
    DTPinstdate3.Enabled = True
    txtinstamt4.Enabled = True
    DTPinstdate4.Enabled = True
    txtinstamt5.Enabled = True
    DTPinstdate5.Enabled = True
    txtinstamt6.Enabled = True
    DTPinstdate6.Enabled = True
    txtinstamt7.Enabled = True
    DTPinstdate7.Enabled = True
    txtinstamt8.Enabled = True
    DTPinstdate8.Enabled = True
    txtbalamt.Enabled = True
    DTPlearfrom.Enabled = True
     DTPlearto.Enabled = True
End Sub

Private Sub cmddelete_Click()

If rs3.State Then
   rs3.Close
End If

 sql = "delete  from studentdetails where regno=" & Int(txtregno.Text) & ""
 rs3.Open sql, cn, adOpenKeyset, adLockOptimistic
txtregno.Text = ""
  txtlearnearsno.Text = ""
   txtname.Text = ""
    txthousename.Text = ""
     txtaddress.Text = ""
     txtplace.Text = ""
     txtlclass.Text = ""
     txtphoneno.Text = ""
     dtpictestdate.Value = Date
     txtos.Text = ""
chkss.Value = False
txtclamt.Text = ""
    chkmcwtgr.Value = False
     chkmcwithoutgr.Value = False
    chklmv.Value = False
     chkmgv.Value = False
     chkmpv.Value = False
     chkhgv.Value = False
     chkhpv.Value = False
     chkthreewheel.Value = False
     chkautoric.Value = False
     txttotalfees.Text = "0"
     txtinstamt1.Text = "0"
   txtinstamt2.Text = "0"
    txtinstamt3.Text = "0"
     txtinstamt4.Text = "0"
     txtinstamt5.Text = "0"
     txtinstamt6.Text = "0"
     txtinstamt7.Text = "0"
     txtinstamt8.Text = "0"
   DTPmy.Value = Date
   DTPmy1.Value = Date
DTPmy2.Value = Date
DTPmy3.Value = Date
DTPmy4.Value = Date
DTPmy5.Value = Date
     DTPmy6.Value = Date
DTPmy7.Value = Date
DTPmy8.Value = Date
DTPmy9.Value = Date
DTPmy10.Value = Date
     DTPmy11.Value = Date
DTPmy12.Value = Date
DTPmy13.Value = Date
DTPmy14.Value = Date
DTPmy15.Value = Date
     DTPmy16.Value = Date
DTPmy17.Value = Date
DTPmy18.Value = Date
DTPmy19.Value = Date
DTPmy20.Value = Date
    DTPmy21.Value = Date
DTPmy22.Value = Date
DTPmy23.Value = Date
     DTPmy24.Value = Date
DTPmy25.Value = Date
DTPmy26.Value = Date
DTPmy27.Value = Date
DTPmy28.Value = Date
     DTPmy29.Value = Date
DTPmy30.Value = Date

     DTPinstdate1.Value = Date
     DTPinstdate2.Value = Date
    DTPinstdate3.Value = Date
    DTPinstdate4.Value = Date
     DTPinstdate5.Value = Date
   DTPinstdate6.Value = Date
     DTPinstdate7.Value = Date
     DTPinstdate8.Value = Date
     
     DTPlearfrom.Value = Date
     DTPlearto.Value = Date
     txtbalamt.Text = "0"
     cmddelete.Enabled = False
cmdadd.Enabled = True
cmdedit.Enabled = False
cmdsave.Enabled = False
cmdsearch.Enabled = True
txtregno.Enabled = False
    txtlearnearsno.Enabled = False
    txtname.Enabled = False
    txthousename.Enabled = False
    txtos.Enabled = False
txtclamt.Enabled = False
chkss.Enabled = False
    txtaddress.Enabled = False
    txtplace.Enabled = False
    txtlclass.Enabled = False
    txtphoneno.Enabled = False
    dtpictestdate.Enabled = False
    chkmcwtgr.Enabled = False
    chkmcwithoutgr.Enabled = False
    chklmv.Enabled = False
    chkmgv.Enabled = False
    chkmpv.Enabled = False
    chkhgv.Enabled = False
    chkhpv.Enabled = False
    chkthreewheel.Enabled = False
    chkautoric.Enabled = False
    txttotalfees.Enabled = False
    DTPmy.Enabled = False
    DTPmy1.Enabled = False
DTPmy2.Enabled = False
DTPmy3.Enabled = False
DTPmy4.Enabled = False
DTPmy5.Enabled = False
    DTPmy6.Enabled = False
DTPmy7.Enabled = False
DTPmy8.Enabled = False
DTPmy9.Enabled = False
DTPmy10.Enabled = False
    DTPmy11.Enabled = False
DTPmy12.Enabled = False
DTPmy13.Enabled = False
DTPmy14.Enabled = False
DTPmy15.Enabled = False
    DTPmy16.Enabled = False
DTPmy17.Enabled = False
DTPmy18.Enabled = False
DTPmy19.Enabled = False
DTPmy20.Enabled = False
    DTPmy21.Enabled = False
DTPmy22.Enabled = False
DTPmy23.Enabled = False
    DTPmy24.Enabled = False
DTPmy25.Enabled = False
DTPmy26.Enabled = False
DTPmy27.Enabled = False
DTPmy28.Enabled = False
    DTPmy29.Enabled = False
DTPmy30.Enabled = False
    DTPinstdate1.Enabled = False
    DTPinstdate2.Enabled = False
    DTPinstdate3.Enabled = False
    DTPinstdate4.Enabled = False
    DTPinstdate5.Enabled = False
    DTPinstdate6.Enabled = False
    DTPinstdate7.Enabled = False
    DTPinstdate8.Enabled = False
    
    

    txtinstamt1.Enabled = False
    DTPinstdate1.Enabled = False
    txtinstamt2.Enabled = False
    DTPinstdate2.Enabled = False
    txtinstamt3.Enabled = False
    DTPinstdate3.Enabled = False
    txtinstamt4.Enabled = False
    DTPinstdate4.Enabled = False
    txtinstamt5.Enabled = False
    DTPinstdate5.Enabled = False
    txtinstamt6.Enabled = False
    DTPinstdate6.Enabled = False
    txtinstamt7.Enabled = False
    DTPinstdate7.Enabled = False
    txtinstamt8.Enabled = False
    DTPinstdate8.Enabled = False
    txtbalamt.Enabled = False
     DTPlearfrom.Enabled = False
     DTPlearto.Enabled = False
     MsgBox "DATA SUCCESS TO DELETE"
End Sub

Private Sub cmdedit_Click()
cmddelete.Enabled = False
cmdadd.Enabled = True
cmdedit.Enabled = False
cmdsave.Enabled = True
cmdsearch.Enabled = True
txtregno.Enabled = True
    txtlearnearsno.Enabled = True
    txtname.Enabled = True
    txthousename.Enabled = True
    txtaddress.Enabled = True
    txtplace.Enabled = True
    txtlclass.Enabled = True
    txtphoneno.Enabled = True
    txtos.Enabled = True
txtclamt.Enabled = True
chkss.Enabled = True
    dtpictestdate.Enabled = True
    chkmcwtgr.Enabled = True
    chkmcwithoutgr.Enabled = True
    chklmv.Enabled = True
    chkmgv.Enabled = True
    chkmpv.Enabled = True
    chkhgv.Enabled = True
    chkhpv.Enabled = True
    chkthreewheel.Enabled = True
    chkautoric.Enabled = True
    txttotalfees.Enabled = True
    DTPmy.Enabled = True
    DTPmy1.Enabled = True
DTPmy2.Enabled = True
DTPmy3.Enabled = True
DTPmy4.Enabled = True
DTPmy5.Enabled = True
    DTPmy6.Enabled = True
DTPmy7.Enabled = True
DTPmy8.Enabled = True
DTPmy9.Enabled = True
DTPmy10.Enabled = True
    DTPmy11.Enabled = True
DTPmy12.Enabled = True
DTPmy13.Enabled = True
DTPmy14.Enabled = True
DTPmy15.Enabled = True
    DTPmy16.Enabled = True
DTPmy17.Enabled = True
DTPmy18.Enabled = True
DTPmy19.Enabled = True
DTPmy20.Enabled = True
    DTPmy21.Enabled = True
DTPmy22.Enabled = True
DTPmy23.Enabled = True
    DTPmy24.Enabled = True
DTPmy25.Enabled = True
DTPmy26.Enabled = True
DTPmy27.Enabled = True
DTPmy28.Enabled = True
    DTPmy29.Enabled = True
DTPmy30.Enabled = True

    DTPinstdate1.Enabled = True
    DTPinstdate2.Enabled = True
    DTPinstdate3.Enabled = True
    DTPinstdate4.Enabled = True
    DTPinstdate5.Enabled = True
    DTPinstdate6.Enabled = True
    DTPinstdate7.Enabled = True
    DTPinstdate8.Enabled = True
    
    txtinstamt1.Enabled = True
    DTPinstdate1.Enabled = True
    txtinstamt2.Enabled = True
    DTPinstdate2.Enabled = True
    txtinstamt3.Enabled = True
    DTPinstdate3.Enabled = True
    txtinstamt4.Enabled = True
    DTPinstdate4.Enabled = True
    txtinstamt5.Enabled = True
    DTPinstdate5.Enabled = True
    txtinstamt6.Enabled = True
    DTPinstdate6.Enabled = True
    txtinstamt7.Enabled = True
    DTPinstdate7.Enabled = True
    txtinstamt8.Enabled = True
    DTPinstdate8.Enabled = True
    txtbalamt.Enabled = True
    DTPlearfrom.Enabled = True
     DTPlearto.Enabled = True
End Sub

Private Sub cmdsave_Click()
If rs4.State Then
   rs4.Close
End If

 sql = "delete  from studentdetails where regno=" & Int(txtregno.Text) & ""
 rs4.Open sql, cn, adOpenKeyset, adLockOptimistic

If rs.State Then
   rs.Close
End If

 sql = "select * from studentdetails where regno=" & 0 & ""
 rs.Open sql, cn, adOpenKeyset, adLockOptimistic
   If rs.RecordCount = 0 Then
   With rs

.AddNew
    !RegNo = txtregno.Text
    !learnersno = txtlearnearsno.Text
    !Name = txtname.Text
    !housename = txthousename.Text
    !address = txtaddress.Text
    !place = txtplace.Text
    !totalclass = txtlclass.Text
    !phoneno = txtphoneno.Text
    !testdate = dtpictestdate.Value
    !mcwithgr = chkmcwtgr.Value
    !mcwithoutgr = chkmcwithoutgr.Value
    !oschool = txtos.Text
!sschool = chkss.Value
!tyamount = txtclamt.Text

    !lmv = chklmv.Value
    !mgv = chkmgv.Value
    !mpv = chkmpv.Value
    !hgv = chkhgv.Value
    !hpv = chkhpv.Value
    !threewheeler = chkthreewheel.Value
    !autoric = chkautoric.Value
    !lenfromdate = DTPlearfrom.Value
    !lentodate = DTPlearto.Value
    If Not Trim(txttotalfees.Text) = "" Then
    
    !totalfees = txttotalfees.Text
    Else
    !totalfees = 0
    End If
    If Not Trim(txtinstamt1.Text) = "" Then
    !instamt1 = txtinstamt1.Text
    Else
    !instamt1 = 0
    End If
    If Not Trim(txtinstamt2.Text) = "" Then
    !instamt2 = txtinstamt2.Text
    Else
    !instamt2 = 0
    End If
    If Not Trim(txtinstamt3.Text) = "" Then
    !instamt3 = txtinstamt3.Text
    Else
    !instamt3 = 0
    End If
    If Not Trim(txtinstamt4.Text) = "" Then
    !instamt4 = txtinstamt4.Text
    Else
    !instamt4 = 0
    End If
    If Not Trim(txtinstamt5.Text) = "" Then
    !instamt5 = txtinstamt5.Text
    Else
   !instamt5 = 0
    End If
    If Not Trim(txtinstamt6.Text) = "" Then
    !instamt6 = txtinstamt6.Text
    Else
    !instamt6 = 0
    End If
    If Not Trim(txtinstamt7.Text) = "" Then
    !instamt7 = txtinstamt7.Text
    Else
    !instamt7 = 0
    End If
    If Not Trim(txtinstamt8.Text) = "" Then
    !instamt8 = txtinstamt8.Text
    Else
    !instamt8 = 0
    End If
    
    !mydate = DTPmy.Value
    !mydate1 = DTPmy1.Value
!mydate2 = DTPmy2.Value
!mydate3 = DTPmy3.Value
!mydate4 = DTPmy4.Value
!mydate5 = DTPmy5.Value
    !mydate6 = DTPmy6.Value
!mydate7 = DTPmy7.Value
!mydate8 = DTPmy8.Value
!mydate9 = DTPmy9.Value
!mydate10 = DTPmy10.Value
    !mydate11 = DTPmy11.Value
!mydate12 = DTPmy12.Value
!mydate13 = DTPmy13.Value
!mydate14 = DTPmy14.Value
!mydate15 = DTPmy15.Value
    !mydate16 = DTPmy16.Value
!mydate17 = DTPmy17.Value
!mydate18 = DTPmy18.Value
!mydate19 = DTPmy19.Value
!mydate20 = DTPmy20.Value
    !mydate21 = DTPmy21.Value
!mydate22 = DTPmy22.Value
!mydate23 = DTPmy23.Value
    !mydate24 = DTPmy24.Value
!mydate25 = DTPmy25.Value
!mydate26 = DTPmy26.Value
!mydate27 = DTPmy27.Value
!mydate28 = DTPmy28.Value
    !mydate29 = DTPmy29.Value
!mydate30 = DTPmy30.Value

    !instdate1 = DTPinstdate1.Value
    !instdate2 = DTPinstdate2.Value
    !instdate3 = DTPinstdate3.Value
    !instdate4 = DTPinstdate4.Value
    !instdate5 = DTPinstdate5.Value
    !instdate6 = DTPinstdate6.Value
    !instdate7 = DTPinstdate7.Value
    !instdate8 = DTPinstdate8.Value
     
    txtbalamt.Text = Int(txttotalfees.Text) - (Int(txtinstamt1.Text) + Int(txtinstamt2.Text) + Int(txtinstamt3.Text) + Int(txtinstamt4.Text) + Int(txtinstamt5.Text) + Int(txtinstamt6.Text) + Int(txtinstamt7.Text) + Int(txtinstamt8.Text))
    If Not Trim(txtbalamt.Text) = "" Then
    !balance = txtbalamt.Text
    Else
    !balance = 0
    End If
    
    MsgBox "DATA SUCCESS TO SAVE"
    
    .Update
    End With
End If
txtregno.Text = ""
  txtlearnearsno.Text = ""
   txtname.Text = ""
    txthousename.Text = ""
     txtaddress.Text = ""
     txtphoneno.Text = ""
     txtplace.Text = ""
     txtlclass.Text = ""
     dtpictestdate.Value = Date
     txtos.Text = ""
chkss.Value = False
txtclamt.Text = ""
    chkmcwtgr.Value = False
     chkmcwithoutgr.Value = False
    chklmv.Value = False
     chkmgv.Value = False
     chkmpv.Value = False
     chkhgv.Value = False
     chkhpv.Value = False
     chkthreewheel.Value = False
     chkautoric.Value = False
     txttotalfees.Text = "0"
     txtinstamt1.Text = "0"
   txtinstamt2.Text = "0"
    txtinstamt3.Text = "0"
     txtinstamt4.Text = "0"
     txtinstamt5.Text = "0"
     txtinstamt6.Text = "0"
     txtinstamt7.Text = "0"
     txtinstamt8.Text = "0"
     DTPmy.Value = Date
     DTPmy1.Value = Date
DTPmy2.Value = Date
DTPmy3.Value = Date
DTPmy4.Value = Date
DTPmy5.Value = Date
     DTPmy6.Value = Date
DTPmy7.Value = Date
DTPmy8.Value = Date
DTPmy9.Value = Date
DTPmy10.Value = Date
     DTPmy11.Value = Date
DTPmy12.Value = Date
DTPmy13.Value = Date
DTPmy14.Value = Date
DTPmy15.Value = Date
     DTPmy16.Value = Date
DTPmy17.Value = Date
DTPmy18.Value = Date
DTPmy19.Value = Date
DTPmy20.Value = Date
    DTPmy21.Value = Date
DTPmy22.Value = Date
DTPmy23.Value = Date
     DTPmy24.Value = Date
DTPmy25.Value = Date
DTPmy26.Value = Date
DTPmy27.Value = Date
DTPmy28.Value = Date
     DTPmy29.Value = Date
DTPmy30.Value = Date
     DTPinstdate1.Value = Date
     DTPinstdate2.Value = Date
    DTPinstdate3.Value = Date
    DTPinstdate4.Value = Date
     DTPinstdate5.Value = Date
   DTPinstdate6.Value = Date
     DTPinstdate7.Value = Date
     DTPinstdate8.Value = Date
     
     DTPlearfrom.Value = Date
     DTPlearto.Value = Date
     txtbalamt.Text = "0"
    cmddelete.Enabled = False
    cmdadd.Enabled = True
    cmdedit.Enabled = False
    cmdsave.Enabled = False
    cmdsearch.Enabled = True
    txtregno.Enabled = False
    txtlearnearsno.Enabled = False
    txtname.Enabled = False
    txtos.Enabled = False
txtclamt.Enabled = False
chkss.Enabled = False
    txthousename.Enabled = False
    txtaddress.Enabled = False
    txtplace.Enabled = False
    txtlclass.Enabled = False
    txtphoneno.Enabled = False
    dtpictestdate.Enabled = False
    chkmcwtgr.Enabled = False
    chkmcwithoutgr.Enabled = False
    chklmv.Enabled = False
    chkmgv.Enabled = False
    chkmpv.Enabled = False
    chkhgv.Enabled = False
    chkhpv.Enabled = False
    chkthreewheel.Enabled = False
    chkautoric.Enabled = False
    txttotalfees.Enabled = False
    DTPmy.Enabled = False
    DTPmy1.Enabled = False
DTPmy2.Enabled = False
DTPmy3.Enabled = False
DTPmy4.Enabled = False
DTPmy5.Enabled = False
    DTPmy6.Enabled = False
DTPmy7.Enabled = False
DTPmy8.Enabled = False
DTPmy9.Enabled = False
DTPmy10.Enabled = False
    DTPmy11.Enabled = False
DTPmy12.Enabled = False
DTPmy13.Enabled = False
DTPmy14.Enabled = False
DTPmy15.Enabled = False
    DTPmy16.Enabled = False
DTPmy17.Enabled = False
DTPmy18.Enabled = False
DTPmy19.Enabled = False
DTPmy20.Enabled = False
    DTPmy21.Enabled = False
DTPmy22.Enabled = False
DTPmy23.Enabled = False
    DTPmy24.Enabled = False
DTPmy25.Enabled = False
DTPmy26.Enabled = False
DTPmy27.Enabled = False
DTPmy28.Enabled = False
    DTPmy29.Enabled = False
DTPmy30.Enabled = False
    DTPinstdate1.Enabled = False
    DTPinstdate2.Enabled = False
    DTPinstdate3.Enabled = False
    DTPinstdate4.Enabled = False
    DTPinstdate5.Enabled = False
    DTPinstdate6.Enabled = False
    DTPinstdate7.Enabled = False
    DTPinstdate8.Enabled = False
    
    txtinstamt1.Enabled = False
    DTPinstdate1.Enabled = False
    txtinstamt2.Enabled = False
    DTPinstdate2.Enabled = False
    txtinstamt3.Enabled = False
    DTPinstdate3.Enabled = False
    txtinstamt4.Enabled = False
    DTPinstdate4.Enabled = False
    txtinstamt5.Enabled = False
    DTPinstdate5.Enabled = False
    txtinstamt6.Enabled = False
    DTPinstdate6.Enabled = False
    txtinstamt7.Enabled = False
    DTPinstdate7.Enabled = False
    txtinstamt8.Enabled = False
    DTPinstdate8.Enabled = False
    txtbalamt.Enabled = False
    DTPlearfrom.Enabled = False
     DTPlearto.Enabled = False
End Sub

Private Sub cmdsearch_Click()
 MSFlexGrid1.Rows = 1
MSFlexGrid1.Visible = True
If rs5.State Then
   rs5.Close
End If

i = 1
MSFlexGrid1.TextMatrix(0, 0) = "RegNo"
         MSFlexGrid1.TextMatrix(0, 1) = "NAME"
If Optname.Value = True Then
sql = "select * from studentdetails where name like '" & "%" & Trim(txtsrchname.Text) & "%" & "'"
 rs5.Open sql, cn, adOpenKeyset, adLockOptimistic
   While Not rs5.EOF
        MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
         MSFlexGrid1.TextMatrix(i, 0) = rs5.Fields!RegNo
         MSFlexGrid1.TextMatrix(i, 1) = rs5.Fields!Name
         
         rs5.MoveNext
        i = i + 1
        
        Wend
  End If
If Opttestdate.Value = True Then
sql = "select * from studentdetails where testdate = #" & DTPsrchtestdate.Value & "# "
 rs5.Open sql, cn, adOpenKeyset, adLockOptimistic
  While Not rs5.EOF
        MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
         MSFlexGrid1.TextMatrix(i, 0) = rs5.Fields!RegNo
         MSFlexGrid1.TextMatrix(i, 1) = rs5.Fields!Name
         
         rs5.MoveNext
        i = i + 1
        
        Wend
End If


If Optlenvaon.Value = True Then
sql = "select * from studentdetails where lentodate = #" & DTPlenvalon.Value & "# "
 rs5.Open sql, cn, adOpenKeyset, adLockOptimistic
  While Not rs5.EOF
        MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
         MSFlexGrid1.TextMatrix(i, 0) = rs5.Fields!RegNo
         MSFlexGrid1.TextMatrix(i, 1) = rs5.Fields!Name
         
         rs5.MoveNext
        i = i + 1
        
        Wend
End If

If Optvabt.Value = True Then
sql = "select * from studentdetails where lentodate >= #" & DTPlenvalfrom.Value & "# and lentodate <= #" & DTplernvalto.Value & "#"
 rs5.Open sql, cn, adOpenKeyset, adLockOptimistic
  While Not rs5.EOF
  MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
         MSFlexGrid1.TextMatrix(i, 0) = rs5.Fields!RegNo
         MSFlexGrid1.TextMatrix(i, 1) = rs5.Fields!Name
         
         rs5.MoveNext
        i = i + 1
        
        Wend
End If
If optclamt.Value = True Then
sql = "select * from studentdetails where tyamount like '" & "%" & Trim(txtsrtyamt.Text) & "%" & "'"
 rs5.Open sql, cn, adOpenKeyset, adLockOptimistic
   While Not rs5.EOF
        MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
         MSFlexGrid1.TextMatrix(i, 0) = rs5.Fields!RegNo
         MSFlexGrid1.TextMatrix(i, 1) = rs5.Fields!Name
         
         rs5.MoveNext
        i = i + 1
        
        Wend
  End If
End Sub

Private Sub Form_Load()
sngDailyRate = 12.5
    sngNumberOfDays = 0
'    Days.Text = Format(sngNumberOfDays, "General Number")
    sngHireCost = 0
    strLastName = ""
    strFirstName = ""
    HireCost = Format(sngHireCost, "Currency")
Optname.Value = True
txtsrchname.Enabled = True
cmddelete.Enabled = False
cmdadd.Enabled = True
cmdedit.Enabled = False
cmdsave.Enabled = False
cmdsearch.Enabled = True
MSFlexGrid1.ColWidth(0) = 0
MSFlexGrid1.Visible = False


    txtregno.Enabled = False
    txtlearnearsno.Enabled = False
    txtname.Enabled = False
    txthousename.Enabled = False
    txtplace.Enabled = False
    txtlclass.Enabled = False
    txtaddress.Enabled = False
    txtphoneno.Enabled = False
    txtos.Enabled = False
txtclamt.Enabled = False
chkss.Enabled = False
    dtpictestdate.Enabled = False
    chkmcwtgr.Enabled = False
    chkmcwithoutgr.Enabled = False
    chklmv.Enabled = False
    chkmgv.Enabled = False
    chkmpv.Enabled = False
    chkhgv.Enabled = False
    chkhpv.Enabled = False
    chkthreewheel.Enabled = False
    chkautoric.Enabled = False
    txttotalfees.Enabled = False
    DTPmy.Enabled = False
    DTPmy1.Enabled = False
DTPmy2.Enabled = False
DTPmy3.Enabled = False
DTPmy4.Enabled = False
DTPmy5.Enabled = False
    DTPmy6.Enabled = False
DTPmy7.Enabled = False
DTPmy8.Enabled = False
DTPmy9.Enabled = False
DTPmy10.Enabled = False
    DTPmy11.Enabled = False
DTPmy12.Enabled = False
DTPmy13.Enabled = False
DTPmy14.Enabled = False
DTPmy15.Enabled = False
    DTPmy16.Enabled = False
DTPmy17.Enabled = False
DTPmy18.Enabled = False
DTPmy19.Enabled = False
DTPmy20.Enabled = False
    DTPmy21.Enabled = False
DTPmy22.Enabled = False
DTPmy23.Enabled = False
    DTPmy24.Enabled = False
DTPmy25.Enabled = False
DTPmy26.Enabled = False
DTPmy27.Enabled = False
DTPmy28.Enabled = False
    DTPmy29.Enabled = False
DTPmy30.Enabled = False
    DTPinstdate1.Enabled = False
    DTPinstdate2.Enabled = False
    DTPinstdate3.Enabled = False
    DTPinstdate4.Enabled = False
    DTPinstdate5.Enabled = False
    DTPinstdate6.Enabled = False
    DTPinstdate7.Enabled = False
    DTPinstdate8.Enabled = False
    
    txtinstamt1.Enabled = False
    DTPinstdate1.Enabled = False
    txtinstamt2.Enabled = False
    DTPinstdate2.Enabled = False
    txtinstamt3.Enabled = False
    DTPinstdate3.Enabled = False
    txtinstamt4.Enabled = False
    DTPinstdate4.Enabled = False
    txtinstamt5.Enabled = False
    DTPinstdate5.Enabled = False
    txtinstamt6.Enabled = False
    DTPinstdate6.Enabled = False
    txtinstamt7.Enabled = False
    DTPinstdate7.Enabled = False
    txtinstamt8.Enabled = False
    DTPinstdate8.Enabled = False
    txtbalamt.Enabled = False
    DTPlearfrom.Enabled = False
     DTPlearto.Enabled = False
    
    
    
End Sub



Private Sub MSFlexGrid1_DblClick()
Frame3.Visible = False
cmdedit.Enabled = True
cmddelete.Enabled = True
cmdadd.Enabled = True
cmdsave.Enabled = False
cmdsearch.Enabled = True
MSFlexGrid1.Visible = False
If rs2.State Then
   rs2.Close
End If

 sql = "select * from studentdetails where regno=" & Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & ""
 rs2.Open sql, cn, adOpenKeyset, adLockOptimistic
   If rs2.RecordCount > 0 Then
   With rs2
    

   txtregno.Text = .Fields!RegNo
  txtlearnearsno.Text = .Fields!learnersno
   txtname.Text = .Fields!Name
txtplace.Text = .Fields!place
   txtlclass.Text = .Fields!totalclass
    txthousename.Text = .Fields!housename
    txtaddress.Text = .Fields!address
     txtphoneno.Text = .Fields!phoneno
    dtpictestdate.Value = .Fields!testdate
    txtos.Text = .Fields!oschool
chkss.Value = .Fields!sschool
txtclamt.Text = .Fields!tyamount

    chkmcwtgr.Value = .Fields!mcwithgr
     chkmcwithoutgr.Value = .Fields!mcwithoutgr
     chklmv.Value = .Fields!lmv
     chkmgv.Value = .Fields!mgv
      chkmpv.Value = .Fields!mpv
     chkhgv.Value = .Fields!hgv
    chkhpv.Value = .Fields!hpv
     chkthreewheel.Value = .Fields!threewheeler
     chkautoric.Value = .Fields!autoric
    
   DTPmy.Value = .Fields!mydate
    DTPmy1.Value = .Fields!mydate1
DTPmy2.Value = .Fields!mydate2
DTPmy3.Value = .Fields!mydate3
DTPmy4.Value = .Fields!mydate4
 DTPmy5.Value = .Fields!mydate5
    DTPmy6.Value = .Fields!mydate6
DTPmy7.Value = .Fields!mydate7
DTPmy8.Value = .Fields!mydate8
DTPmy9.Value = .Fields!mydate9
DTPmy10.Value = .Fields!mydate10
    DTPmy11.Value = .Fields!mydate11
DTPmy12.Value = .Fields!mydate12
DTPmy13.Value = .Fields!mydate13
DTPmy14.Value = .Fields!mydate14
DTPmy15.Value = .Fields!mydate15
DTPmy16.Value = .Fields!mydate16
    DTPmy17.Value = .Fields!mydate17
DTPmy18.Value = .Fields!mydate18
DTPmy19.Value = .Fields!mydate19
DTPmy20.Value = .Fields!mydate20
DTPmy21.Value = .Fields!mydate21
    DTPmy22.Value = .Fields!mydate22
    
    DTPmy23.Value = .Fields!mydate23
    DTPmy24.Value = .Fields!mydate24
DTPmy25.Value = .Fields!mydate25
DTPmy26.Value = .Fields!mydate26
DTPmy27.Value = .Fields!mydate27
 DTPmy28.Value = .Fields!mydate28
    DTPmy29.Value = .Fields!mydate29
DTPmy30.Value = .Fields!mydate30
    
    
    
    
    
    txttotalfees.Text = .Fields!totalfees
    dtpictestdate.Value = .Fields!testdate
     DTPlearfrom.Value = .Fields!lenfromdate
     DTPlearto.Value = .Fields!lentodate
    DTPinstdate1.Value = Date
    DTPinstdate2.Value = Date
    DTPinstdate3.Value = Date
    DTPinstdate4.Value = Date
    DTPinstdate5.Value = Date
    DTPinstdate6.Value = Date
    DTPinstdate7.Value = Date
    DTPinstdate8.Value = Date
    
  
     
     
     txtinstamt1.Text = .Fields!instamt1
     If Not Trim(txtinstamt1.Text = 0) Then
    DTPinstdate1.Value = .Fields!instdate1
     End If
    txtinstamt2.Text = .Fields!instamt2
    If Not Trim(txtinstamt2.Text = 0) Then
    DTPinstdate2.Value = .Fields!instdate2
     End If
    txtinstamt3.Text = .Fields!instamt3
    If Not Trim(txtinstamt3.Text = 0) Then
     
    DTPinstdate3.Value = .Fields!instdate3
     End If
    txtinstamt4.Text = .Fields!instamt4
   If Not Trim(txtinstamt4.Text = 0) Then
      
    DTPinstdate4.Value = .Fields!instdate4
    End If
    txtinstamt5.Text = .Fields!instamt5
    If Not Trim(txtinstamt5.Text = 0) Then
     
     DTPinstdate5.Value = .Fields!instdate5
      End If
     txtinstamt6.Text = .Fields!instamt6
     If Not Trim(txtinstamt6.Text = 0) Then
     
   DTPinstdate6.Value = .Fields!instdate6
    End If
   txtinstamt7.Text = .Fields!instamt7
    If Not Trim(txtinstamt7.Text = 0) Then
    
    DTPinstdate7.Value = .Fields!instdate7
     End If
    txtinstamt8.Text = .Fields!instamt8
    If Not Trim(txtinstamt8.Text = 0) Then
     
    
    DTPinstdate8.Value = .Fields!instdate8
     End If
  txtbalamt.Text = .Fields!balance
    
    
    
    
   
    End With
End If
txtregno.Enabled = False
    txtlearnearsno.Enabled = False
    txtname.Enabled = False
    txthousename.Enabled = False
    txtplace.Enabled = False
    txtlclass.Enabled = False
    txtos.Enabled = False
txtclamt.Enabled = False
chkss.Enabled = False
    txtaddress.Enabled = False
    txtphoneno.Enabled = False
    dtpictestdate.Enabled = False
    chkmcwtgr.Enabled = False
    chkmcwithoutgr.Enabled = False
    chklmv.Enabled = False
    chkmgv.Enabled = False
    chkmpv.Enabled = False
    chkhgv.Enabled = False
    chkhpv.Enabled = False
    chkthreewheel.Enabled = False
    chkautoric.Enabled = False
    txttotalfees.Enabled = False
    DTPmy.Enabled = False
    DTPmy1.Enabled = False
DTPmy2.Enabled = False
DTPmy3.Enabled = False
DTPmy4.Enabled = False
DTPmy5.Enabled = False
    DTPmy6.Enabled = False
DTPmy7.Enabled = False
DTPmy8.Enabled = False
DTPmy9.Enabled = False
DTPmy10.Enabled = False
    DTPmy11.Enabled = False
DTPmy12.Enabled = False
DTPmy13.Enabled = False
DTPmy14.Enabled = False
DTPmy15.Enabled = False
    DTPmy16.Enabled = False
DTPmy17.Enabled = False
DTPmy18.Enabled = False
DTPmy19.Enabled = False
DTPmy20.Enabled = False
    DTPmy21.Enabled = False
DTPmy22.Enabled = False
DTPmy23.Enabled = False
    DTPmy24.Enabled = False
DTPmy25.Enabled = False
DTPmy26.Enabled = False
DTPmy27.Enabled = False
DTPmy28.Enabled = False
    DTPmy29.Enabled = False
DTPmy30.Enabled = False

    DTPinstdate1.Enabled = False
    DTPinstdate2.Enabled = False
    DTPinstdate3.Enabled = False
    DTPinstdate4.Enabled = False
    DTPinstdate5.Enabled = False
    DTPinstdate6.Enabled = False
    DTPinstdate7.Enabled = False
    DTPinstdate8.Enabled = False
    
    
    txtinstamt1.Enabled = False
    DTPinstdate1.Enabled = False
    txtinstamt2.Enabled = False
    DTPinstdate2.Enabled = False
    txtinstamt3.Enabled = False
    DTPinstdate3.Enabled = False
    txtinstamt4.Enabled = False
    DTPinstdate4.Enabled = False
    txtinstamt5.Enabled = False
    DTPinstdate5.Enabled = False
    txtinstamt6.Enabled = False
    DTPinstdate6.Enabled = False
    txtinstamt7.Enabled = False
    DTPinstdate7.Enabled = False
    txtinstamt8.Enabled = False
    DTPinstdate8.Enabled = False
    txtbalamt.Enabled = False
    DTPlearfrom.Enabled = False
     DTPlearto.Enabled = False
End Sub

Private Sub optclamt_Click()

If optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False


ElseIf Optname.Value = True Then
txtsrchname.Enabled = True
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
txtsrtyamt.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
End If
End Sub


Private Sub Optlenvaon_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
txtsrtyamt.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
End If
End Sub

Private Sub Optname_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrtyamt.Enabled = False
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
End If

'ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
End Sub

Private Sub Opttestdate_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
txtsrtyamt.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
txtsrtyamt.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
txtsrtyamt.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True

ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False


End If

End Sub

Private Sub Optvabt_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
txtsrtyamt.Enabled = False

ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False


End If
End Sub


Private Sub PrintForm_Click()
    PrintForm
End Sub



--------------------MODULE SOURCE CODE------------

Option Explicit
Global cn As New Connection
Public Sub open_connection()
End Sub

Public Sub Main()
If cn.State Then cn.Close
cn.Open "microfox", "t", "a26yo1a01i0oo8Qr5ty51w521bipa"
frmSplash.Show
End Sub

Attached image(s)

  • Attached Image

This post has been edited by andrewsw: 28 May 2013 - 10:41 AM
Reason for edit:: Highlight your code and click the CODE button


Is This A Good Question/Topic? 0
  • +

Replies To: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

#2 josh0709  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 20-February 13

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 28 May 2013 - 10:49 AM

you could try using a temp file and save the image as long binary data in the access database i will try and dig up some of my old code when i did it
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3624
  • View blog
  • Posts: 12,535
  • Joined: 12-December 12

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 28 May 2013 - 10:55 AM

Your code is frightful and hurting my eyes!! So many unnecessary lines?! I strongly encourage you to study Arrays and (in VB6) Control Arrays.

This Microsoft link discusses storing images in an Access database. Although not directly relevant from VB6, there is a link towards the bottom of the page showing how to use VBA to display images. (VB6 will be quite similar.)

It is preferable (particularly in Access 2003) to store only the file-name and path to the images, and use VB to add, display and delete them.

Control Arrays tutorial

This post has been edited by andrewsw: 28 May 2013 - 11:02 AM

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3624
  • View blog
  • Posts: 12,535
  • Joined: 12-December 12

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 28 May 2013 - 11:11 AM

.. however, you might wait for josh0709 and a more specific (VB6) example.
Was This Post Helpful? 0
  • +
  • -

#5 bobykuriakose12  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 28-May 13

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 28 May 2013 - 11:24 AM

thank you for your information.i also attached edited source code.please give me a solution for how to add student photo on my form,how to save and how to retrieve student photo.i also create one database entry name is image1 and property oledb. i am student i have no more about vb,its only reference from internet.

please help me is very urgent one,

---------my students enty form source code------
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim i As Integer
Dim sngDailyRate As Single
Dim sngNumberOfDays As Integer
Dim sngHireCost As Single

Dim strLastName As String * 20
Dim strFirstName As String * 20
Dim s As String
Dim sql As String


--------------------[MODULE SOURCE CODE]------------

Option Explicit
Global cn As New Connection
Public Sub open_connection()
End Sub

Public Sub Main()
If cn.State Then cn.Close
cn.Open "microfox", "t", "a26yo1a01i0oo8Qr5ty51w521bipa"
frmSplash.Show
End Sub

-------------------------------------------------

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#6 josh0709  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 20-February 13

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 28 May 2013 - 12:19 PM

ok i dont know how much help this will be as it uses a dao connection but the code could be manipulated. To start with you need a to add a new field in access e.g. photo and make that an OLE Object then on your form design (this is how i did mine) insert these 6 items. An image box, DriveListBox, DirListBox, FileListBox, Textbox and a command button. this is the code to connect them together.

Private Sub Dir1_Change()
On Error GoTo errtrap
File1.Path = Dir1.Path
Exit Sub
errtrap:
End Sub

Private Sub Drive1_Change()
On Error GoTo errtrap:
Dir1.Path = Drive1.Drive
Exit Sub
errtrap:
End Sub

Private Sub File1_Click()
On Error GoTo errtrap:
Text1 = File1.FileName
Exit Sub
errtrap:
End Sub



ok now you have to be able to save the image as a temp file so it can be inserted into your database


Private Sub Command1_Click()
'save image

On Error GoTo errtrap:
picname = Text2
mempic = App.Path & "\" & picname

Image1.Picture = LoadPicture(mempic)

Exit Sub
errtrap: MsgBox "please select valid image"
End Sub




so now you tell the database to store the picture as long binary data (put this in add new person at the top of the code)


Private Sub Command1_Click()
'addnew member


Dim arrImageByte() As Byte, strPhotoPath As String
  
    gym = App.Path & "\gym.mdb"
    Set gymm = DBEngine.OpenDatabase(gym)
    Set rst = gymm.OpenRecordset("customer")
    
  
  

  SavePicture Me.Image1.Picture, App.Path & "\tmpphoto.jpg"
  
  strPhotoPath = App.Path & "\tmpphoto.jpg"


ReDim arrImageByte(FileLen(strPhotoPath))
       
        Open strPhotoPath For Binary As #1
        Get #1, , arrImageByte
        Close 1




then to add the picture just write underneath
.Fields("photo") = arrImageByte



I dont know how much help this will be as it took me a while to get my head around at first but its a starting block
Was This Post Helpful? 0
  • +
  • -

#7 bobykuriakose12  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 28-May 13

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 06 June 2013 - 11:20 PM

DEAR SIR,THANK YOU FOR YOUR VALUABLE INFORMATION.BUT I AM TRYING THAT SOURCE IS NOT WORKING.I AM TRYING ANOTHER METHOD--DETAILS ARE-----

I AM TRYING TO INSERT IMAGE ON VB FORM(GETCHUNK--METHOD),IT IS SUCCESSFULLY SAVED AND TRYING TO RETRIEVE IN SAME TIME ITS OK AND TRYING TO EDIT THAT FORM AND TRYING TO SAVE,ITS WORKING BUT CREATE A SAME ANOTHER ENTRY ON DATABASE.BUT IF I CLOSED THAT APPLICATION,BUT AFTER RE-LOGIN, ITS NOT RETRIVING.AT THAT TIME SHOW ERROR MESSAGE ----(RUN-TIME ERROR-3001 ARGUMENTS ARE OF THE WRONG TYPE,ARE OUT OF ACCEPTABLE RANGE,OR ARE IN CONFLICT WITH ONE ANOTHER)--- .I AM ALSO ATTACHED MY SOURCE CODE.CAN U PLS ANSWER MY REQUEST.

Attached File(s)

  • Attached File  VB.doc (41K)
    Number of downloads: 53

Was This Post Helpful? 0
  • +
  • -

#8 bobykuriakose12  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 28-May 13

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 06 June 2013 - 11:40 PM

I AM A STUDENT IN VISUAL BASIC.I AM TRYING TO INSERT IMAGE ON VB FORM(GETCHUNK--METHOD),IT IS SUCCESSFULLY SAVED AND TRYING TO RETRIEVE IN SAME TIME ITS OK AND TRYING TO EDIT THAT FORM AND TRYING TO SAVE,ITS WORKING BUT CREATE A SAME ANOTHER ENTRY ON DATABASE.BUT IF I CLOSED THAT APPLICATION,BUT AFTER RE-LOGIN, ITS NOT RETRIVING.AT THAT TIME SHOW ERROR MESSAGE ----(RUN-TIME ERROR-3001 ARGUMENTS ARE OF THE WRONG TYPE,ARE OUT OF ACCEPTABLE RANGE,OR ARE IN CONFLICT WITH ONE ANOTHER)--- .I AM ALSO ATTACHED MY SOURCE CODE.CAN U PLS ANSWER MY REQUEST.

REGARDS
BOBY KURIAKOSE

-------------------

Option Explicit

Const BLOCK_SIZE As Long = 100000 'bytes

Dim cnnEmp As ADODB.Connection
Dim rsEMP As ADODB.Recordset

Dim fileSize As Long
Dim fileName As String
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim i As Integer
Dim s As String
Dim sql As String



Private Sub cmdadd_Click()

txtbalamt.Text = "0"
sql = "select max(regno) as rn from studentdetails"
If rs1.State Then
rs1.Close
End If
rs1.Open sql, cn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount = 0 Then
txtregno.Text = "1"
Else
txtregno.Text = Int(rs1.Fields("rn")) + 1
End If
t

Private Sub cmdsearch_Click()
MSFlexGrid1.Rows = 1
MSFlexGrid1.Visible = True
If rs5.State Then
rs5.Close
End If

i = 1
MSFlexGrid1.TextMatrix(0, 0) = "RegNo"
MSFlexGrid1.TextMatrix(0, 1) = "NAME"
If Optname.Value = True Then
sql = "select * from studentdetails where name like '" & "%" & Trim(txtsrchname.Text) & "%" & "'"
rs5.Open sql, cn, adOpenKeyset, adLockOptimistic
While Not rs5.EOF
MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
MSFlexGrid1.TextMatrix(i, 0) = rs5.Fields!RegNo
MSFlexGrid1.TextMatrix(i, 1) = rs5.Fields!Name

rs5.MoveNext
i = i + 1

Wend
End If


Private Sub Form_Load()

Optname.Value = True
txtsrchname.Enabled = True
cmddelete.Enabled = False
cmdadd.Enabled = True
cmdedit.Enabled = False
cmdsave.Enabled = False
cmdsearch.Enabled = True
MSFlexGrid1.ColWidth(0) = 0
MSFlexGrid1.Visible = False



DTPlearto.Enabled = False
Set cnnEmp = New ADODB.Connection
Set rsEMP = New ADODB.Recordset

'Open the Database connection
With cnnEmp
.Provider = "microsoft.jet.oledb.4.0"
.CursorLocation = adUseClient
.Open App.Path & "\data.mdb"
End With

' Open the EMP table.
Dim sSQL As String
sSQL = "select * " & _
" from studentdetails"

With rsEMP
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open sSQL, cnnEmp
End With

ClearFields

End Sub




Private Sub ClearFields()

Dim con As Control

For Each con In Controls
If TypeOf con Is TextBox Then
con.Text = ""
ElseIf TypeOf con Is Image Then
con.Picture = Nothing
End If
Next

End Sub



Private Function ValidateData() As Boolean


ValidateData = True
'End If

End Function



Private Sub FillFields()

Me.MousePointer = vbHourglass







txtregno = "" & rsEMP("RegNo")
txtlearnearsno = "" & rsEMP("learnersno")

DTPmy3 = "" & rsEMP("mydate3")

DTPmy4 = "" & rsEMP("mydate4")


ReadPictureData

Me.MousePointer = vbNormal

End Sub


Private Sub ReadPictureData()

Dim diskFile As String
diskFile = App.Path & "\temp\emp.bmp"

Dim tempDir As String
tempDir = Dir(App.Path & "\temp", vbDirectory)

If tempDir = "" Then
MkDir App.Path & "\temp"
End If

' Delete the temp picture file.
If Len(Dir$(diskFile)) > 0 Then
Kill diskFile
End If

'Get the Phot size
fileSize = rsEMP("Photo").ActualSize

'Get a free file handle
Dim destfileNum As Long
destfileNum = FreeFile

'Open the file
Open diskFile For Binary As destfileNum

'Calculate the number of blocks (100000 bytes blocks)
Dim pictBlocks As Integer
pictBlocks = fileSize / BLOCK_SIZE

'Calculate the left over data
Dim leftOverData As Long
leftOverData = fileSize Mod BLOCK_SIZE

'Byte array for Picture data.
Dim pictData() As Byte
'Get the left over data first
pictData() = rsEMP("Photo").GetChunk(leftOverData)

'write the binary picture data from a variable to disk file
Put destfileNum, , pictData()

Dim i

'Now get the remaining binary picture data in Blocks of 100000
For i = 1 To pictBlocks
pictData() = rsEMP("Photo").GetChunk(BLOCK_SIZE)
Put destfileNum, , pictData()
Next i

'Close the file handle
Close destfileNum

'Load the temp Picture into the Image control
Image1.Picture = LoadPicture(App.Path & "\temp\emp.bmp")

End Sub

Private Sub cmdSave_Click()

' This procedure Saves the employee information to the DB.
' converts that Image file to a Byte array, and saves the Byte
' Array to the table using the Appendchunk method.

'Validate the employee information
If ValidateData = False Then

Exit Sub

Else

Me.MousePointer = vbHourglass

'Get a Free file handle
Dim sourceFile As Integer
sourceFile = FreeFile

'Open the Photo
Open fileName For Binary Access Read As sourceFile

'Get the size of the file in bytes
fileSize = LOF(sourceFile)

If fileSize = 0 Then

Close sourceFile

MsgBox "Employee's Photo is invalid"
Exit Sub

Else

'Calculate the number of blocks (100000 bytes blocks)
Dim pictBlocks As Integer
pictBlocks = fileSize / BLOCK_SIZE

'Calculate the left over data
Dim leftOverData As Long
leftOverData = fileSize Mod BLOCK_SIZE

'Byte array for Picture data.
Dim pictData() As Byte
ReDim pictData(leftOverData)

'Reads data from an open disk file into pictData()
Get sourceFile, , pictData()


'Save the Employee Information
rsEMP.AddNew
'Appends the Left Over binary picture data to the Photo field
'in the employee table
rsEMP("Photo").AppendChunk pictData()

ReDim pictData(BLOCK_SIZE)

Dim i As Integer

For i = 1 To pictBlocks
'Read the picture data in blocks of 100000 bytes
Get sourceFile, , pictData()
'appends the binary picture data the Photo field
rsEMP("Photo").AppendChunk pictData()
Next i

' rsEMP("FirstName") = txtFName
'rsEMP("MiddleName") = txtMName
'rsEMP("LastName") = txtLName
'rsEMP("SSN") = txtSSN
'rsEMP("Notes") = txtNotes

'Update the data

rsEMP("RegNo") = txtregno.Text
ELSE
rsEMP("instamt8") = 0
End If

End If

rsEMP.Update

'close the file handle
Close sourceFile

End If

Me.MousePointer = vbNormal

'Clear the form
ClearFields

MsgBox "Students information successfully saved"

End If

End Sub

Private Sub Image1_DblClick()

' Retrieve the picture and update the record.
CommonDialog1.Filter = "(*.bmp;*.ico;*.gif;*.jpg)|*.bmp;*.ico;*.gif;*.jpg "
CommonDialog1.ShowOpen

fileName = CommonDialog1.fileName

If fileName <> "" Then
Set Image1.Picture = LoadPicture(fileName)
End If

End Sub

'v1.1 changes
Private Sub Image1_OLEDragOver(Data As DataObject, _
Effect As Long, _
Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single, _
State As Integer)

'vset a drag drop effect
If Data.GetFormat(vbCFFiles) Then
Effect = vbDropEffectCopy And Effect
Exit Sub
End If

Effect = vbDropEffectNone

End Sub



Private Sub Image1_OLEDragDrop(Data As DataObject, _
Effect As Long, _
Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single)

'if File list from Windows Explorer
If Data.GetFormat(vbCFFiles) Then

Dim vFN

For Each vFN In Data.Files
Dim fileExt As String

'get the file ext
fileExt = Mid(vFN, InStrRev(vFN, ".") + 1, Len(vFN))

Select Case UCase(fileExt)
Case "BMP", "GIF", "JPEG", "JPG", "WMF", "TIF", "PNG"
Set Image1.Picture = LoadPicture(vFN)
fileName = vFN
End Select

Next vFN

End If

End Sub
'end of v1.1 changes

Private Sub MSFlexGrid1_DblClick()
cmdedit.Enabled = True
cmddelete.Enabled = True
cmdadd.Enabled = True
cmdsave.Enabled = False
cmdsearch.Enabled = True
MSFlexGrid1.Visible = False
If rs2.State Then
rs2.Close
End If

sql = "select * from studentdetails where RegNo=" & Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & ""
rs2.Open sql, cn, adOpenKeyset, adLockOptimistic
If rs2.RecordCount > 0 Then
With rs2

Me.MousePointer = vbHourglass

'txtFName = "" & rsEMP("FirstName")
'txtLName = "" & rsEMP("LastName")
'txtMName = "" & rsEMP("MiddleName")
'txtSSN = "" & rsEMP("SSN")
'txtNotes = "" & rsEMP("Notes")

ReadPictureData

Me.MousePointer = vbNormal




txtregno = "" & rsEMP("RegNo")
txtlearnearsno = "" & rsEMP("learnersno")


End With
End If

End Sub

Private Sub optclamt_Click()

If optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False


ElseIf Optname.Value = True Then
txtsrchname.Enabled = True
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
txtsrtyamt.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
End If
End Sub


Private Sub Optlenvaon_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
txtsrtyamt.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
End If
End Sub

Private Sub Optname_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrtyamt.Enabled = False
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
End If

'ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
End Sub

Private Sub Opttestdate_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
txtsrtyamt.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
txtsrtyamt.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False
txtsrtyamt.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True

ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False


End If

End Sub

Private Sub Optvabt_Click()
If Optname.Value = True Then
txtsrchname.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Opttestdate.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = True
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optlenvaon.Value = True Then
txtsrchname.Enabled = False
txtsrtyamt.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = True
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False

ElseIf Optvabt.Value = True Then
txtsrchname.Enabled = False
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = True
DTplernvalto.Enabled = True
txtsrtyamt.Enabled = False

ElseIf optclamt.Value = True Then
txtsrtyamt.Enabled = True
DTPsrchtestdate.Enabled = False
DTPlenvalon.Enabled = False
DTPlenvalfrom.Enabled = False
DTplernvalto.Enabled = False


End If
End Sub

Attached File(s)

  • Attached File  VB.doc (41K)
    Number of downloads: 65

This post has been edited by andrewsw: 07 June 2013 - 03:50 AM
Reason for edit:: Learn to use the CODE tags

Was This Post Helpful? 0
  • +
  • -

#9 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3624
  • View blog
  • Posts: 12,535
  • Joined: 12-December 12

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 07 June 2013 - 03:54 AM

I've merged this with your other post; please don't create duplicate topics.

To display your code properly, highlight your code and press the CODE button that appears above where you are typing your post. Press the Preview Post button until it is correct.

You are more likely to receive a response if you learn to use the SHIFT key on your keyboard. Your post is extremely difficult to read, whether all in UPPERCASE or lowercase.
Was This Post Helpful? 0
  • +
  • -

#10 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3624
  • View blog
  • Posts: 12,535
  • Joined: 12-December 12

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 07 June 2013 - 05:31 AM

Quote

Run-time error-3001 Arguments are of the wrong type,are out of acceptable range,or are in conflict with one another.

This error message is quite clear, or it would be if we knew which line it referred to.
Was This Post Helpful? 0
  • +
  • -

#11 josh0709  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 20-February 13

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 07 June 2013 - 10:11 AM

i will have a look how it could be fixed but you are better off posting your project in full (vb project, forms and access database) also any components or references used so it allows me to get a clear indication

This post has been edited by josh0709: 07 June 2013 - 10:13 AM

Was This Post Helpful? 0
  • +
  • -

#12 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3624
  • View blog
  • Posts: 12,535
  • Joined: 12-December 12

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 07 June 2013 - 10:26 AM

View Postjosh0709, on 07 June 2013 - 05:11 PM, said:

i will have a look how it could be fixed but you are better off posting your project in full (vb project, forms and access database) also any components or references used so it allows me to get a clear indication

I doubt that you should be encouraging someone to post their entire project on a forum-thread (including an Access Database!). This is something you might request with a private communication.
Was This Post Helpful? 1
  • +
  • -

#13 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 09 June 2013 - 03:01 PM

in a database i'm making right now all the pictures are saved localy.
while i use a different way to load them on my program it is possible to simply save the file path of the picture into the database and later retrive it and load the picture.
however for this you have to guarantee that every computer that use your program will have the files in the exact same path.
Was This Post Helpful? 0
  • +
  • -

#14 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3624
  • View blog
  • Posts: 12,535
  • Joined: 12-December 12

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 09 June 2013 - 04:04 PM

@Neku It should be stressed that setting absolute paths is okay for a brief test, but these should be quickly changed to independent paths, making the application portable. There are a number of different Path properties for this purpose.
Was This Post Helpful? 0
  • +
  • -

#15 bobykuriakose12  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 28-May 13

Re: HOW TO ADD PICTURE ON VB-ACCESS 2003,HOW TO SAVE AND RETRIEVE

Posted 10 June 2013 - 01:08 AM

thank you sir,i am not understand .what field are required to change? in database or code?can you please exactly mention?which lines are error?


regards
boby
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2