SQL Insert into shows error

meenctg

Learn24bd
Local time
Today, 21:44
Joined
May 8, 2012
Messages
133
My code is

Code:
Private Sub Form_AfterUpdate()
Dim SQL As String
CurrentDb.Execute ("INSERT INTO Receive(ToAc,TransactionNo,AmountReceive) VALUES(" & Me.BkashAccount & "," & Me.BkashAccount & ",'00')")
CurrentDb.Execute ("INSERT INTO Send(From,TransactionNo,AmountSend) VALUES(" & Me.BkashAccount & "," & Me.BkashAccount & ",'00')")
MsgBox "Account added succefully"
End Sub

When i try with first Insert into line. it's ok. But when i do it 2nd one it shows error message. My table name, field name is ok.

Error message
attachment.php


I can't find the mistake. Please help me.
 

Attachments

  • syntext.jpg
    syntext.jpg
    13.9 KB · Views: 283
This is pretty much beyond me, I am not an expert by any stretch of the imagination, but is there a ; missing somewhere?
Graham
 
Debugging 101. You know where its failing, you know what in general is causing it to fail. Now go find out specifically.

Since you are building that SQL string dynamically, you don't know exactly what the SQL statement is--so find out. Instead of executing that SQL (CurrentDB.Execute), spit it out so you can see it (MsgBox, or I think debug.print). If necessary, paste it into a query to see what's wrong with it.
 
But is the table structure ok?
Show a printscreen of both table structures!

I have included the Receive and Send table

Receive table structure
attachment.php


Send table structure
attachment.php
 

Attachments

  • receive table.jpg
    receive table.jpg
    15.3 KB · Views: 222
  • send table.jpg
    send table.jpg
    16.7 KB · Views: 219
I think the evil one is the field name "From", From is also used in queries to determine from which table.
Try to rename the field and ofcause also change it in the sql.
 
I think the evil one is the field name "From", From is also used in queries to determine from which table.
Try to rename the field and ofcause also change it in the sql.

Thank you.
It is working....
 

Users who are viewing this thread

Back
Top Bottom