all thing is ok. all ready 11 item was saved. in sr. no. 12 when I input all necessary thing and click in save button massage was show " save data". no error massage show. but the data is not save in database. I don't know why? So I need help please.

Probably, you have done spelling mistake somewhere or something else. Without observing your codes, we can't help you. So, its better to post your save button's codes and table's field name.

Private Sub cmdsave_Click()
If cmbIName = "" Then
MsgBox "Plese Select Item Name.", vbCritical, Me.Caption
cmbIName.SetFocus
Exit Sub
End If

If cmbISize = "" Then
MsgBox "Please Select Item Size ", vbCritical, Me.Caption
cmbISize.SetFocus
Exit Sub
End If

If txtDadIQty = "" Then
MsgBox "Please Enter Quantity ", vbCritical, Me.Caption
txtDadIQty.SetFocus
Exit Sub
End If

If cmbOrTkBy = "" Then
MsgBox "Please Select Order Taken Name ", vbCritical, Me.Caption
cmbOrTkBy.SetFocus
Exit Sub
End If

CheckData "Dad", "PartyName", cmbPartyName.Text
If HH = "NOT OK" Then

            With rs
    .Open "Select * from Dad", con, adOpenDynamic, adLockOptimistic
    .AddNew
    !SrNo = GetNewNo("Dad")
    !DadItems = UCase(cmbIName)
    !DadSize = UCase(cmbISize)
    !Dad = txtDadIQty
    !Dadby = UCase(cmbOrTkBy)
    !DadDate = DadDate
    !PartyName = UCase(cmbPartyName)
    !amount = txtamount.Text
    !due = txtdue.Text
    !Receive = txtreceive.Text
    !profit = txtprofit.Text
    .Update
    .Close
    MsgBox "Information is Saved", vbInformation, Me.Caption
End With

Else

With rs
rs.Open "Select * from Dad where PartyName = '" & Me.cmbPartyName & "'", con, adOpenKeyset, adLockOptimistic

    .Fields("due") = rs.Fields("due") + Val(Me.txtdue)
.Update
.Close
    MsgBox "Information is Saved", vbInformation, Me.Caption
End With
End If


Set rs = Nothing
Call ClearAll
End Sub

In module

Public Function CheckData(ByVal TName As String, TField As String, H As String)
On Error Resume Next
Dim cnh As New ADODB.Connection
Dim rsh As New ADODB.Recordset

cnh.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database\InvData.mdb;Persist Security Info=False"
cnh.Open
rsh.Open "Select " & TField & " From " & TName & " Where " & TName & "." & TField & " ='" & UCase(H) & "'", cnh, adOpenDynamic, adLockOptimistic
If rsh.EOF = True And rsh.BOF = True Then
    HH = "NOT OK"
Else
    HH = "OK"
End If
rsh.Close
cnh.Close
Set rsh = Nothing
Set cnh = Nothing
End Function

I find out the problem. It happend when I enter same PartyName. Then it happend. no id change. it only update the due amount. I try to solved it. I think I can.
You guys also welcom.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.