i am facing difficulty in updating msacess database for several columns
with following code

Public Sub connect()
Dim path As String
path = App.path & "\chss.mdb"
cnn.CursorLocation = adUseClient
If rs.State = 1 Then rs.Close
cnn.Open "provider = microsoft.jet.oledb.4.0;persist security info=false;data source = " & path
End Sub


Public Sub SAVEEXPMAIN()
cnn.Execute "update EMPCHSS set cccno = '" & Text2 & "', GENDER = '" & Combo4 & "',DOB = '" & DTP1 & "', ben_name = '" & Text3 & _
"', AGE = '" & Label14 & "', rela_ship = '" & Combo1 & "', main_sub = '" & Combo8 & "', emp_name = '" & Text4 & _
"', desig = '" & Combo3 & "', unit = '" & Combo5 & "', SECTION = '" & Combo2 & "', BASIC = " & Text5 & _
", gp = " & Combo6 & ", address = '" & Text6 & "', chssat = '" & Combo7 & "' where chssno = " & Text1


cnn.Execute "UPDATE EMPCHSS SET SECTION =' " & Combo2 & "', DESGN = '" & Combo3 & "', BASIC = " & Val(Text5) & " WHERE ccno = '" & Text2 & "'"
end sub


Private Sub Command1_Click()
If Text1 = "" Then
MsgBox "Please Fill CHSS NO.."
Text1.SetFocus
Exit Sub
ElseIf Text2 = "" Then
MsgBox "Please Fill C  C  NO.."
Text2.SetFocus
Exit Sub
ElseIf Text3 = "" Then
MsgBox "Please Fill BENIFISARY NAME.."
Text3.SetFocus
Exit Sub
ElseIf Combo3 = "" Then
MsgBox "Please SELECT GENDER .."
Combo3.SetFocus
Exit Sub
ElseIf Combo1 = "" Then
MsgBox "Please SELECT RELATION .."
Combo1.SetFocus
Exit Sub
ElseIf Combo8 = "" Then
MsgBox "Please SELECT MAIN OR SUB .."
Combo8.SetFocus
Exit Sub
ElseIf Text4 = "" Then
MsgBox "Please Fill EMPLOYEE NAME.."
Text4.SetFocus
Exit Sub
ElseIf Combo3 = "" Then
MsgBox "Please SELECT DESIGNATION .."
Combo3.SetFocus
Exit Sub
ElseIf Combo5 = "" Then
MsgBox "Please SELECT UNIT .."
Combo5.SetFocus
Exit Sub
ElseIf Combo2 = "" Then
MsgBox "Please SELECT SECTION .."
Combo2.SetFocus
Exit Sub
ElseIf Combo6 = "" Then
MsgBox "Please SELECT GRADE PAY .."
Combo6.SetFocus
Exit Sub
ElseIf Text6 = "" Then
MsgBox "Please Fill Address."
Text6.SetFocus
Exit Sub
ElseIf Combo7 = "" Then
MsgBox "Please SELECT CHSS AT .."
Combo7.SetFocus
Exit Sub
ElseIf Text5 = "" Then
MsgBox "Please Fill BASIC.."
Text5.SetFocus
Exit Sub
ElseIf Text7 = "" Then
MsgBox "Please Fill BLOOD GROUP.."
Text7.SetFocus
Exit Sub
End If
If IsNumeric(Combo6) Then
Combo6 = Format(Combo6, "00.00")
Else
MsgBox "Value Must be numeric IN GRADE PAY COLUMN"
Combo6 = ""
Combo6.SetFocus
       Exit Sub
    End If

If IsNumeric(Text5) Then
Text5 = Format(Text5, "00.00")
Else
MsgBox "Value Must be numeric IN BASIC COLUMN"
Text5 = ""
Text5.SetFocus
       Exit Sub
    End If

SAVEEXPMAIN


End Sub

pl advice

thanks

Edited 5 Years Ago by Narue: Added code tags...not that it helped. :P

I don't see in your code where you ever execute your "connect" subroutine. What error are you getting?

Tell the what error message you are getting while executing those codes, because you connect() sub is may not be called(executed).

This article has been dead for over six months. Start a new discussion instead.