0

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.

2
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by abu taher
0

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.

0
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

Edited by abu taher

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.