Hi,
i new in programming and just trying to make 1 access program following from youtube, to add, edit, search, but i got stuck on "add" step
my idea is using text box to input fileds i just created before i created table PR as follows :
PRnumber ->number
created ->date/time
desc->text
user->text
price -> currency
qty ->Number
PO->Number
Recv->Date/time
i use text box to insert to those fields,and added some command button to triger the command below is my VB script
Private Sub cmdAdd_Click() -> add command button
'add data to table
CurrentDb.Execute "INSERT INTO PR(PRNumber, Created, Desc, user, price, qty, vendor ,PO, Recv)" & _
" VALUES (" & Me.txtprnumber & ",'" & Me.txtprcreated & "','" & Me.txtdesc & "','" & Me.txtusr & "','" _
& Me.txtusr & "'," & Me.txtprice & "," & Me.txtqty & ",'" & Me.txtvendor & "'," & Me.txtpo & ",'" & Me.txtrcv & "')"
'clear form
cmdClear_Click
'refresh data in list on form
frmPRSub.Form.Requery
End Sub
Private Sub cmdClear_Click() -> clear command button
Me.txtprnumber = ""
Me.txtprcreated = ""
Me.txtdesc = ""
Me.txtusr = ""
Me.txtprice = ""
Me.txtqty = ""
Me.txtvendor = ""
Me.txtpo = ""
Me.txtrcv = ""
'focus on PR Number text box
Me.txtprnumber.SetFocus
End Sub
Private Sub cmdClose_Click() -> close command button
DoCmd.Close
End Sub
and everytime i click add it always shows Runtime "Error 3134 - Syntax Error in INSERT INTO Statement"
and click debug access is hilighting :
CurrentDb.Execute "INSERT INTO PR(PRNumber, Created, Desc, user, price, qty, vendor ,PO, Recv)" & _
" VALUES (" & Me.txtprnumber & ",'" & Me.txtprcreated & "','" & Me.txtdesc & "','" & Me.txtusr & "','" _
& Me.txtusr & "'," & Me.txtprice & "," & Me.txtqty & ",'" & Me.txtvendor & "'," & Me.txtpo & ",'" & Me.txtrcv & "')"
i don't know where is the issue, i will be vey thankfull for any enlightment
thanks
syahrul
i new in programming and just trying to make 1 access program following from youtube, to add, edit, search, but i got stuck on "add" step
my idea is using text box to input fileds i just created before i created table PR as follows :
PRnumber ->number
created ->date/time
desc->text
user->text
price -> currency
qty ->Number
PO->Number
Recv->Date/time
i use text box to insert to those fields,and added some command button to triger the command below is my VB script
Private Sub cmdAdd_Click() -> add command button
'add data to table
CurrentDb.Execute "INSERT INTO PR(PRNumber, Created, Desc, user, price, qty, vendor ,PO, Recv)" & _
" VALUES (" & Me.txtprnumber & ",'" & Me.txtprcreated & "','" & Me.txtdesc & "','" & Me.txtusr & "','" _
& Me.txtusr & "'," & Me.txtprice & "," & Me.txtqty & ",'" & Me.txtvendor & "'," & Me.txtpo & ",'" & Me.txtrcv & "')"
'clear form
cmdClear_Click
'refresh data in list on form
frmPRSub.Form.Requery
End Sub
Private Sub cmdClear_Click() -> clear command button
Me.txtprnumber = ""
Me.txtprcreated = ""
Me.txtdesc = ""
Me.txtusr = ""
Me.txtprice = ""
Me.txtqty = ""
Me.txtvendor = ""
Me.txtpo = ""
Me.txtrcv = ""
'focus on PR Number text box
Me.txtprnumber.SetFocus
End Sub
Private Sub cmdClose_Click() -> close command button
DoCmd.Close
End Sub
and everytime i click add it always shows Runtime "Error 3134 - Syntax Error in INSERT INTO Statement"
and click debug access is hilighting :
CurrentDb.Execute "INSERT INTO PR(PRNumber, Created, Desc, user, price, qty, vendor ,PO, Recv)" & _
" VALUES (" & Me.txtprnumber & ",'" & Me.txtprcreated & "','" & Me.txtdesc & "','" & Me.txtusr & "','" _
& Me.txtusr & "'," & Me.txtprice & "," & Me.txtqty & ",'" & Me.txtvendor & "'," & Me.txtpo & ",'" & Me.txtrcv & "')"
i don't know where is the issue, i will be vey thankfull for any enlightment
thanks
syahrul