-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Since you're assigning the value of Forms!AllowData!To to RejDate I'll
assume that it is a Date data type. Therefore, the assignment of the
calculation:
(Forms!AllowData!To-Forms!AllowData!From)+3
or (Forms!AllowData!To-Forms!AllowData!From)+1
to the column AllowData.Worked, a Numeric data type, is causing the
error. I.e., you are assigning a Date to a Numeric column (field) - the
result of the above calculations will be a Date.
If you want the number of days worked use the DateDiff() function:
Worked = DateDiff("d", Forms!AllowData!From, Forms!AllowData!To) +
IIf(WeekDay(Forms!AllowData!To)=5,3,1)
(5 = vbThursday)
Also, it is a good idea to declare the data type in the query of
references to dates on forms. E.g.:
PARAMETERS Forms!AllowData!From Date, Forms!AllowData!To Date;
UPDATE AllowData
SET Worked = DateDiff("d", Forms!AllowData!From, Forms!AllowData!To) +
IIf(WeekDay(Forms!AllowData!To)=5,3,1) ,
.... etc. ...
HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBSrJteoechKqOuFEgEQLApQCePej1nnLPuIp/1WFH1Jh0MosJ6VgAoILF
jfEnmw17LZbixW8KdYO2HUVD
=llCe
-----END PGP SIGNATURE-----
Table.
Allowance :text
Class :text
EmpNo :text
Name :text
TtlAllowance :text
Worked Num
Amount Num
Status :text
RjDate : Date
Update Query
UPDATE AllowData SET AllowData.Worked =
IIf(dayname(Forms!AllowData!To)="Thursday",(Forms!AllowData!To-Forms!AllowData!From)+3,(Forms!AllowData!To-Forms!AllowData!From)+1),
AllowData.Amount = ([TtlAllowance]/30)*[Worked], AllowData.RejDate =
Forms!AllowData!To
WHERE (((AllowData.EmpNo)=Forms!AllowData!EmpNo) And
((AllowData.Status)="Rejoined"));
:
Post the SQL of your query. To do so, open the query in design mode,
display
it in SQL view, copy the entire text to the body of your message.
Also post a description of the table you are updating - name and type
of
each field.
-TedMi
Please any one can help, I'm trying to run update query but always
message
appear like ((query name) didn't update 4 fields, due to type
conversation
failure 0 records, due to key violations 0 records.. etc
How I can prevent this message from appearing always when I run the
update
query?
Thanks