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

Update query with date not working 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am using access 2003 and trying to write an update query to update a date field. I am trying to combine three fields from different tables to create this date.
All fields are integers. If I run the query for the dbo_dic_Period table cal_num = 1 and year = 2015. From the z_CloseSched table I would get 9 for a date of 1/9/2015.
Any Help is appreciated.

Tom

Code:
UPDATE z_CloseSched, dbo_dic_Period SET z_CloseSched.closedt = "#" & [dbo_dic_Period].[cal_num] & "/" & [defdom] & "/" & [dbo_dic_Period].[yr] & "#"
WHERE (((dbo_dic_Period.calpddiff)=0) AND ((z_CloseSched.uci)="AAC"));
 
where are your database(s)

Code:
UPDATE z_CloseSched, dbo_dic_Period SET z_CloseSched.closedt = "#" & [dbo_dic_Period].[cal_num] & "/" & [defdom] & "/" & [dbo_dic_Period].[yr] & "#"
WHERE (((dbo_dic_Period.calpddiff)=0) AND ((z_CloseSched.uci)="AAC"));
 
The databases are : dbo_dic_Period and z_CloseSched
 
I can't imagine an Acces query with more than one table and no joins would be updateable. I typically use the DateSerial() function to create dates from year, month, and day of month.

Is this VBA? Is there more code you can share?

Duane
Hook'D on Access
MS Access MVP
 
I'm with Duane, eg:
SQL:
UPDATE z_CloseSched 
SET closedt = DateSerial(DlookUp("yr","dbo_dic_Period","calpddiff=0"),DlookUp("cal_num","dbo_dic_Period","calpddiff=0"),defdom)
WHERE uci="AAC"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top