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!

Too complex error message with update query

Status
Not open for further replies.

Sam92Legacy

Technical User
Sep 9, 2002
52
US
I have a script which runs a make table query, then runs an update query, and finally prints a report. The query worked without a hitch on a the first computer I used (AccessXP), but I get an error message during the update query that says "The expression is typed incorrectly, or is too complex to be evaluated." on the computer I imported it to (Also running AccessXP). I can run the queries without a problem when I run them outside of the script, however.

The update query is:

UPDATE (Main INNER JOIN [Pledge Sum] ON Main.ContactID = [Pledge Sum].ContactID) INNER JOIN Events ON (Main.ContactID = Events.ContactID) AND ([Pledge Sum].ContactID = Events.ContactID) SET Events.EventCode = [Pledge Sum]![Amount]
WHERE (((Events.Event)=[Pledge Sum]![LastOfSource]));

and the script is:

Dim stDocName As String

DoCmd.SetWarnings True
'run the make table query
DoCmd.OpenQuery ("PledgeSummary")
'run the update query
DoCmd.OpenQuery ("EventCodeUpdate")
stDocName = "Events"
DoCmd.OpenReport stDocName, acPreview

Any suggestions on where I went wrong would be much appreciated.

Thanks,

Sam
 
Right off hand I don't see how it would work since you have:
[tt]
UPDATE Main ... SET Events.EventCode
[/tt]
If you're updating Events.EventCode shouldn't it be:
[tt]
UPDATE Events ... SET Events.EventCode
[/tt]
VBSlammer
redinvader3walking.gif
 
Your're right that I didn't need the Main table. I switched it to:
UPDATE Events INNER JOIN [Pledge Sum] ON Events.ContactID = [Pledge Sum].ContactID SET Events.EventCode = [Pledge Sum]![Amount]
WHERE (((Events.Event)=[Pledge Sum]![LastOfSource]));

However, I still am getting the same error message when I am it in my form.
 
Why would you set the EventCode to a dollar amount? Maybe you have a data type mismatch there. VBSlammer
redinvader3walking.gif
 
I think there is a type mismatch; fortunately, I figured out a union query that give the correct results and does away with both the action queries. Thanks for helping point out my novice errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top