VB-runtime error-3001 (arguments are of the wrong type,are out of acceptable range,or are in conflict with one another)

10 pts.
Tags:
Visual Basic
Visual Basic Error Messages
Dear sir, I am a student in Visual Basic. I am trying to insert image on VB form (GetChunk--method). It is successfully saved and I'm trying to retrieve in same time. It's okay. I'm also trying to edit that form and trying to save it. It's working but it's creating the same entry in the database. Also, if I close that application and after re-login, its not retrieving. At that time, it shows 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 have also attached my source code. Can you please answer my request. Regards boby kuriakose ---- '*********************************************************************************** ' Store and Retrive Images from Access DB ' --Illustrates how to store and retrive images from an Access DB ' ' Version Info ' ------------ ' v1.0 08/14/2001 Pyash Origination ' v1.1 02/22/2006 Pyash Add OLE Drag and Drop capability to assign an image to ' the Employee ' v1.2 02/25/2006 Pyash Added Name and Note fields to the DB and form ' v1.3 10/11/2006 Pyash Modified the ReadPictureData routine to create the temp ' directory in the app.path '*********************************************************************************** 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() 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 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 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 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 & "tempemp.bmp") End Sub Private Sub cmdFirst_Click() If rsEMP.State = adStateOpen Then On Error Resume Next rsEMP.MoveFirst If Not rsEMP.EOF Then ClearFields FillFields cmdsave.Enabled = False End If End If End Sub Private Sub cmdLast_Click() If rsEMP.State = adStateOpen Then On Error Resume Next rsEMP.MoveLast If Not rsEMP.EOF Then ClearFields FillFields cmdsave.Enabled = False End If End If End Sub Private Sub cmdNext_Click() If rsEMP.State = adStateOpen Then On Error Resume Next rsEMP.MoveNext If Not rsEMP.EOF Then ClearFields FillFields cmdsave.Enabled = False Else rsEMP.MoveLast If Not rsEMP.BOF Then ClearFields FillFields cmdsave.Enabled = False End If End If End If End Sub Private Sub cmdPrevious_Click() If rsEMP.State = adStateOpen Then On Error Resume Next rsEMP.MovePrevious If Not rsEMP.BOF Then ClearFields FillFields cmdsave.Enabled = False Else rsEMP.MoveFirst If Not rsEMP.EOF Then ClearFields FillFields cmdsave.Enabled = False End If End If End If End Sub Private Sub cmdClear_Click() ClearFields cmdsave.Enabled = True 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 rsEMP("learnersno") = txtlearnearsno.Text rsEMP("Name") = txtname.Text rsEMP("housename") = txthousename.Text rsEMP("address") = txtaddress.Text rsEMP("place") = txtplace.Text rsEMP("totalclass") = txtlclass.Text rsEMP("phoneno") = txtphoneno.Text rsEMP("testdate") = dtpictestdate.Value rsEMP("mcwithgr") = chkmcwtgr.Value rsEMP("mcwithoutgr") = chkmcwithoutgr.Value rsEMP("oschool") = txtos.Text 'rsEMP("sschool ") = chkss.Value rsEMP("tyamount") = txtclamt.Text rsEMP("lmv") = chklmv.Value rsEMP("mgv") = chkmgv.Value rsEMP("mpv") = chkmpv.Value rsEMP("hgv") = chkhgv.Value rsEMP("hpv") = chkhpv.Value rsEMP("threewheeler") = chkthreewheel.Value rsEMP("autoric") = chkautoric.Value rsEMP("lenfromdate") = DTPlearfrom.Value rsEMP("lentodate") = DTPlearto.Value If Not Trim(txttotalfees.Text) = "" Then rsEMP("totalfees") = txttotalfees.Text Else rsEMP("totalfees") = 0 End If If Not Trim(txtinstamt1.Text) = "" Then rsEMP("instamt1") = txtinstamt1.Text Else rsEMP("instamt1") = 0 End If If Not Trim(txtinstamt2.Text) = "" Then rsEMP("instamt2") = txtinstamt2.Text Else rsEMP("instamt2") = 0 End If If Not Trim(txtinstamt3.Text) = "" Then rsEMP("instamt3") = txtinstamt3.Text Else rsEMP("instamt3") = 0 End If If Not Trim(txtinstamt4.Text) = "" Then rsEMP("instamt4") = txtinstamt4.Text Else rsEMP("instamt4") = 0 End If If Not Trim(txtinstamt5.Text) = "" Then rsEMP("instamt5") = txtinstamt5.Text Else rsEMP("instamt5") = 0 End If If Not Trim(txtinstamt6.Text) = "" Then rsEMP("instamt6") = txtinstamt6.Text Else rsEMP("instamt6") = 0 End If If Not Trim(txtinstamt7.Text) = "" Then rsEMP("instamt7") = txtinstamt7.Text Else rsEMP("instamt7") = 0 End If If Not Trim(txtinstamt8.Text) = "" Then rsEMP("instamt8") = txtinstamt8.Text Else rsEMP("instamt8") = 0 End If rsEMP("mydate") = DTPmy.Value rsEMP("mydate1") = DTPmy1.Value rsEMP("mydate2") = DTPmy2.Value rsEMP("mydate3") = DTPmy3.Value rsEMP("mydate4") = DTPmy4.Value rsEMP("mydate5") = DTPmy5.Value rsEMP("mydate6") = DTPmy6.Value rsEMP("mydate7") = DTPmy7.Value rsEMP("mydate8") = DTPmy8.Value rsEMP("mydate9") = DTPmy9.Value rsEMP("mydate10") = DTPmy10.Value rsEMP("mydate11") = DTPmy11.Value rsEMP("mydate12") = DTPmy12.Value rsEMP("mydate13") = DTPmy13.Value rsEMP("mydate14") = DTPmy14.Value rsEMP("mydate15") = DTPmy15.Value rsEMP("mydate16") = DTPmy16.Value rsEMP("mydate17") = DTPmy17.Value rsEMP("mydate18") = DTPmy18.Value rsEMP("mydate19") = DTPmy19.Value rsEMP("mydate20") = DTPmy20.Value rsEMP("mydate21") = DTPmy21.Value rsEMP("mydate22") = DTPmy22.Value rsEMP("mydate23") = DTPmy23.Value rsEMP("mydate24") = DTPmy24.Value rsEMP("mydate25") = DTPmy25.Value rsEMP("mydate26") = DTPmy26.Value rsEMP("mydate27") = DTPmy27.Value rsEMP("mydate28") = DTPmy28.Value rsEMP("mydate29") = DTPmy29.Value rsEMP("mydate30") = DTPmy30.Value rsEMP("instdate1") = DTPinstdate1.Value rsEMP("instdate2") = DTPinstdate2.Value rsEMP("instdate3") = DTPinstdate3.Value rsEMP("instdate4") = DTPinstdate4.Value rsEMP("instdate5") = DTPinstdate5.Value rsEMP("instdate6") = DTPinstdate6.Value rsEMP("instdate7") = DTPinstdate7.Value rsEMP("instdate8") = DTPinstdate8.Value 'rsEMP("balance") = txtbalamt.Text txtbalamt.Text = rsEMP("totalfees") - (rsEMP("instamt1") + rsEMP("instamt2") + rsEMP("instamt3") + rsEMP("instamt4") + rsEMP("instamt5") + rsEMP("instamt6") + rsEMP("instamt7") + rsEMP("instamt8")) If Not Trim(txtbalamt.Text) = "" Then rsEMP("balance") = txtbalamt.Text Else rsEMP("balance") = 0 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 Form_Unload(Cancel As Integer) 'Close and terminate the conection and recordset objects If rsEMP.State = adStateOpen Then rsEMP.Close Set rsEMP = Nothing If cnnEmp.State = adStateOpen Then cnnEmp.Close Set cnnEmp = Nothing 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 Label32_Click() Dim theWebSite As String theWebSite = "http://www.keralamvd.gov.in/" Call Shell("explorer.exe " & theWebSite, vbNormalFocus) End Sub 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 ' txtFName = "" & rsEMP("FirstName") 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") txtname = "" & rsEMP("Name") txtplace = "" & rsEMP("place") txtlclass = "" & rsEMP("totalclass") txthousename = "" & rsEMP("housename") txtaddress = "" & rsEMP("address") txtphoneno = "" & rsEMP("phoneno") dtpictestdate = "" & rsEMP("testdate") txtos = "" & rsEMP("oschool") 'chkss = "" & rsEMP("sschool") txtclamt = "" & rsEMP("tyamount") chkmcwtgr = "" & rsEMP("mcwithgr") chkmcwithoutgr = "" & rsEMP("mcwithoutgr") chklmv = "" & rsEMP("lmv") chkmgv = "" & rsEMP("mgv") chkmpv = "" & rsEMP("mpv") chkhgv = "" & rsEMP("hgv") chkhpv = "" & rsEMP("hpv") chkthreewheel = "" & rsEMP("threewheeler") chkautoric = "" & rsEMP("autoric") DTPmy = "" & rsEMP("mydate") DTPmy1 = "" & rsEMP("mydate1") DTPmy2 = "" & rsEMP("mydate2") DTPmy3 = "" & rsEMP("mydate3") DTPmy4 = "" & rsEMP("mydate4") DTPmy5 = "" & rsEMP("mydate5") DTPmy6 = "" & rsEMP("mydate6") DTPmy7 = "" & rsEMP("mydate7") DTPmy8 = "" & rsEMP("mydate8") DTPmy9 = "" & rsEMP("mydate9") DTPmy10 = "" & rsEMP("mydate10") DTPmy11 = "" & rsEMP("mydate11") DTPmy12 = "" & rsEMP("mydate12") DTPmy13 = "" & rsEMP("mydate13") DTPmy14 = "" & rsEMP("mydate14") DTPmy15 = "" & rsEMP("mydate15") DTPmy16 = "" & rsEMP("mydate16") DTPmy17 = "" & rsEMP("mydate17") DTPmy18 = "" & rsEMP("mydate18") DTPmy19 = "" & rsEMP("mydate19") DTPmy20 = "" & rsEMP("mydate20") DTPmy21 = "" & rsEMP("mydate21") DTPmy22 = "" & rsEMP("mydate22") DTPmy23 = "" & rsEMP("mydate23") DTPmy24 = "" & rsEMP("mydate24") DTPmy25 = "" & rsEMP("mydate25") DTPmy26 = "" & rsEMP("mydate26") DTPmy27 = "" & rsEMP("mydate27") DTPmy28 = "" & rsEMP("mydate28") DTPmy29 = "" & rsEMP("mydate29") DTPmy30 = "" & rsEMP("mydate30") txttotalfees = "" & rsEMP("totalfees") dtpictestdate = "" & rsEMP("testdate") DTPlearfrom = "" & rsEMP("lenfromdate") DTPlearto = "" & rsEMP("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 = "" & rsEMP("instamt1") If Not Trim(txtinstamt1.Text = 0) Then DTPinstdate1 = "" & rsEMP("instdate1") End If txtinstamt2 = "" & rsEMP("instamt2") If Not Trim(txtinstamt2.Text = 0) Then DTPinstdate2 = "" & rsEMP("instdate2") End If txtinstamt3 = "" & rsEMP("instamt3") If Not Trim(txtinstamt3.Text = 0) Then DTPinstdate3 = "" & rsEMP("instdate3") End If txtinstamt4 = "" & rsEMP("instamt4") If Not Trim(txtinstamt4.Text = 0) Then DTPinstdate4 = "" & rsEMP("instdate4") End If txtinstamt5 = "" & rsEMP("instamt5") If Not Trim(txtinstamt5.Text = 0) Then DTPinstdate5 = "" & rsEMP("instdate5") End If txtinstamt6 = "" & rsEMP("instamt6") If Not Trim(txtinstamt6.Text = 0) Then DTPinstdate6 = "" & rsEMP("instdate6") End If txtinstamt7 = "" & rsEMP("instamt7") If Not Trim(txtinstamt7.Text = 0) Then DTPinstdate7 = "" & rsEMP("instdate7") End If txtinstamt8 = "" & rsEMP("instamt8") If Not Trim(txtinstamt8.Text = 0) Then DTPinstdate8 = "" & rsEMP("instdate8") End If txtbalamt = "" & rsEMP("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

Software/Hardware used:
visual basic
ASKED: June 6, 2013  3:28 PM
UPDATED: June 6, 2013  3:29 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following