Link to home
Start Free TrialLog in
Avatar of damixa
damixaFlag for Denmark

asked on

insert statement in vba

Hi,
I was wondering if I can get some help with an insert statement I am running in vba.

I need to insert some records based on the current form

my code is something like this:
CurrentDb.Execute "insert into SER_FAXES_FILE ([ID],[STAFF-Resource NAME OT], [ADDRESS UNIQUE ID]) values (SELECT [ID],[STAFF-Resource NAME OT], [ADDRESS UNIQUE ID] from SER_FAXES_FILE_daily where SER_FAXES_FILE.ID = me.id))"

Open in new window


can I do a insert with a select statement with currentdb.execute? its erroriing out

thanks in advance
Vinnie
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Create stored procedure on server side and exec it with something like:
CurrentDb.Execute "exec sp_yourprocedurename " & [ID] & ", " & [STAFF-Resource NAME OT] (etc.)

Open in new window

First of all - you can embed into SP any logic you want, second, you can exec that procedure from more application functions than one.