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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Updating Table from docmd.runsql

Status
Not open for further replies.

GessTechie

Technical User
Jan 24, 2003
10
US
Good Afternoon...

I want to update a table based upon a docmd.runsql command from a formm

The table has two text field, and two date fields, as well as a primary key.

The form runs great but when it attempts the docmd.runsql statement, it says 0 records to add.

Here is the code:

stUserLogUpdate = "INSERT INTO [User Log] ( [User ID], StartDateTime, EndDateTime, [Account Worked] )SELECT [User Log].[User ID], [User Log].StartDateTime, [User Log].EndDateTime, [User Log].[Account Worked] FROM [User Log]WHERE ((([User Log].[User ID]) = [Forms]![Credit Letter Dispute Starting Window]![Text11]) And (([User Log].StartDateTime) = [Forms]![Credit Letter Dispute Starting Window]![Text19]) And (([User Log].EndDateTime) = Now()) And (([User Log].[Account Worked]) = [Forms]![Collection Dept Credit Report Letter Disputes Resolution Form]![Customer Account Number]))"

DoCmd.RunSQL stUserLogUpdate


I've tried to create a macro to do it and a function but nothing seems to work.

Also, I dont want the user to have an option of the update. How can I get it to just do it without prompts?
 
as to supress the prompts
docmd.setwarnings false 'to turn off prompts
docmd.setwarnings true 'to turn on prompts
as to why there no records to add your syntex is wrong below
is the syntex for a append query
insert into tablename(field1,field2,field3....)
select value1 as expr1,value2 as expr2,value3 as expr3...;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top