Dear Community
Sir I have two fields in a table and both of them are of number Data Type (as per ACCESS format). The following is the code Through which I'm trying to enter a calculated data in the Table
[CODE=vb]Dim Bal_Stock1 As Double
Dim STOCK As Integer
Dim Issued As Integer
Dim Quantity_Stock As Integer
Dim Quantity_Issued As Integer
Dim Bal_Stock As Integer
Quantity_Stock = STOCK
Quantity_Issued = Issued
Bal_Stock = Bal_Stock1
Bal_Stock1 = stbal(STOCK, Issued)
MsgBox (stbal(CDbl(STO CK), CDbl(Issued)))
sql = "INSERT INTO stock(Item_code ,Item_Name,Quan tity_Stock,Unit ,StockValue,Qua ntity_issued,un it1,IssuedValue ,Bal_Stock,Unit 2,StockValue1)V ALUES(" & _
"' " & txtItem_Code.Te xt & "',' " & txtItem_Name.Te xt & " '," & Quantity_Stock & ",' " & txtUnit.Text & "','" & txtStockValue.T ext & "'," & Quantity_Issued & ",' " & txtUnit1.Text & "','" & txtIssuedValue. Text & "', " & Bal_Stock & ",'" & txtUnit2.Text & "',' " & txtstockValue1. Text & "') "[/CODE]
Following is the function through which the calculation is done
[CODE=vb]Function stbal(STOCK As Integer, Issued As Integer) As Double
stbal = STOCK - Issued
End Function[/CODE]
With this above code it is giving
Error "DataType mismatch on criteria expression"
Pls help me
Sir I have two fields in a table and both of them are of number Data Type (as per ACCESS format). The following is the code Through which I'm trying to enter a calculated data in the Table
[CODE=vb]Dim Bal_Stock1 As Double
Dim STOCK As Integer
Dim Issued As Integer
Dim Quantity_Stock As Integer
Dim Quantity_Issued As Integer
Dim Bal_Stock As Integer
Quantity_Stock = STOCK
Quantity_Issued = Issued
Bal_Stock = Bal_Stock1
Bal_Stock1 = stbal(STOCK, Issued)
MsgBox (stbal(CDbl(STO CK), CDbl(Issued)))
sql = "INSERT INTO stock(Item_code ,Item_Name,Quan tity_Stock,Unit ,StockValue,Qua ntity_issued,un it1,IssuedValue ,Bal_Stock,Unit 2,StockValue1)V ALUES(" & _
"' " & txtItem_Code.Te xt & "',' " & txtItem_Name.Te xt & " '," & Quantity_Stock & ",' " & txtUnit.Text & "','" & txtStockValue.T ext & "'," & Quantity_Issued & ",' " & txtUnit1.Text & "','" & txtIssuedValue. Text & "', " & Bal_Stock & ",'" & txtUnit2.Text & "',' " & txtstockValue1. Text & "') "[/CODE]
Following is the function through which the calculation is done
[CODE=vb]Function stbal(STOCK As Integer, Issued As Integer) As Double
stbal = STOCK - Issued
End Function[/CODE]
With this above code it is giving
Error "DataType mismatch on criteria expression"
Pls help me
Comment