Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button - Module

Status
Not open for further replies.

nia

Programmer
Apr 23, 2001
4
US
I am trying to use a statement (attached to a command button) in a module to populate a history table with information from my current form:

dbs.Execute ("INSERT INTO FA_History ( FAHI_AcctNumber, FAHI_Amount, FAHI_InvNumber, " & _
"FAHI_PostDate, FAHI_HistType, FAHI_EffDate, FAHI_DeptID, FAHI_PersonID, FAHI_StampDate ) " & _
"VALUES (AlarmPay.AcctNumber, AlarmPay.AmountOwed, AlarmPay.InvNumber, Now(), " & _
"'TAX', Now(), 'PD', 'PD', Now());

I get a syntax error, but the whole statement is highlighted. I search several platforms trying to find a solution.




 
I'll assume this is VB.
Either put Call in front of the statement or drop the outside parens () because you are calling a SUB without the CALL staement not a FUNCTION...and is that a semi-colon there at the end of the statement? What the heck is that?
Code:
Call dbs.Execute  ("INSERT INTO FA_History ( FAHI_AcctNumber, FAHI_Amount, FAHI_InvNumber, " & _
    "FAHI_PostDate, FAHI_HistType, FAHI_EffDate, FAHI_DeptID, FAHI_PersonID, FAHI_StampDate ) " & _
    "VALUES (AlarmPay.AcctNumber, AlarmPay.AmountOwed, AlarmPay.InvNumber, Now(), " & _
    "'TAX', Now(), 'PD', 'PD', Now())
'******** O R ************************
dbs.Execute  "INSERT INTO FA_History ( FAHI_AcctNumber, FAHI_Amount, FAHI_InvNumber, " & _
    "FAHI_PostDate, FAHI_HistType, FAHI_EffDate, FAHI_DeptID, FAHI_PersonID, FAHI_StampDate ) " & _
    "VALUES (AlarmPay.AcctNumber, AlarmPay.AmountOwed, AlarmPay.InvNumber, Now(), " & _
    "'TAX', Now(), 'PD', 'PD', Now()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top