Prev: Sort with Listbox Selection On Top
Next: Connection string for passthrough query on windows 7 64 bit???
From: LRay67 on 29 Mar 2010 16:24 I have a form that has two fields that are not calculating right. [RemoteNumberHours] = 0.25 [NumberPCS] = 1 Code behind: =[RemoteNumberHours]*[RemotePCS] This should work, but it is giving me a total of 1 instead of 0.25. What am I doing wrong? Thanks Linda
From: Rich K on 29 Mar 2010 16:30 Looks to me like the code behind ought to be [RemoteNumberHours]*[NumberPCS] "LRay67" wrote: > I have a form that has two fields that are not calculating right. > > [RemoteNumberHours] = 0.25 > [NumberPCS] = 1 > > Code behind: > =[RemoteNumberHours]*[RemotePCS] > > This should work, but it is giving me a total of 1 instead of 0.25. What am > I doing wrong? > Thanks > Linda
From: Dennis on 29 Mar 2010 16:31 The destination variable is an Integer type. Make it a Double or Float. "LRay67" wrote: > I have a form that has two fields that are not calculating right. > > [RemoteNumberHours] = 0.25 > [NumberPCS] = 1 > > Code behind: > =[RemoteNumberHours]*[RemotePCS] > > This should work, but it is giving me a total of 1 instead of 0.25. What am > I doing wrong? > Thanks > Linda
From: Marshall Barton on 29 Mar 2010 16:49
LRay67 wrote: >I have a form that has two fields that are not calculating right. > >[RemoteNumberHours] = 0.25 >[NumberPCS] = 1 > >Code behind: >=[RemoteNumberHours]*[RemotePCS] > >This should work, but it is giving me a total of 1 instead of 0.25. I don't think that's possible unless there is something else getting in the way. If RemoteNumberHours and NumberPCS are fields in the form's record source table/query and =[RemoteNumberHours]*[RemotePCS]is a text box control's control source, I would expect the result .25 to be displayed (0 if the text box's Format does not allow any decimal places). Or, maybe you are using the word "field" for different things and you have some VBA code doing something odd. -- Marsh MVP [MS Access] |