A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

trouble with setvalue in form



 
 
Thread Tools Display Modes
  #1  
Old July 8th, 2004, 03:33 PM
Pei
external usenet poster
 
Posts: n/a
Default trouble with setvalue in form

Hi all

I am working on creating a inspection form for bridge inspectors. I have created a main form with 3 additional subforms embedded in the main form namely deck, superstructure and substructure. A field for date was created in each of the subform for the inspector to log in when he is inspecting that particular element of the bridge. Each time, the the logged date writes back to separate tables which stores the date, and inspection information. Within the same subform, I have also created a field to show the calculated latest date (strmaxdate) that is stored in the table for that particular bridge. Up to now, everything was successful until I tried to write a conditon macro to update the main form to show the latest date of the "strMaxdate" date from each of the three subforms.


Assuming the max deck date is the greatest:
In the conditon field I wrote:

[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate] And [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate]

In the setvalue Item field:
[Forms]![frm_Routine]![Inspection Date] ( Note: this is a unbound field )


In the setvalue Expression field:
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate]

I wrote a condition for Superstructure and Substructure respectively in the same Macro.....but in the main form [Inspection Date] field returns a empty value.

I also tried to "single step" through the Macro when it runs but even though the deck subform has the latest date then the other two subforms, it still returns a "false" in the "single step condition" window....and I can't adjust the single step window to see why it return false....


Any ideas what's wrong here? your support would be greatly appreciated.

Thanks
Pei

  #2  
Old July 8th, 2004, 03:50 PM
Ken Snell
external usenet poster
 
Posts: n/a
Default trouble with setvalue in form

Using And the way you are, you're telling ACCESS to test if the
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate] *and*
if [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate] is True.

I believe you want to test if
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate] *and*
is greater than [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate].

Assuming this, change the condition statement to

[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Sub].[Form]![strMaxCondSubDate]


"Pei" wrote in message
...
Hi all

I am working on creating a inspection form for bridge inspectors. I have

created a main form with 3 additional subforms embedded in the main form
namely deck, superstructure and substructure. A field for date was created
in each of the subform for the inspector to log in when he is inspecting
that particular element of the bridge. Each time, the the logged date writes
back to separate tables which stores the date, and inspection information.
Within the same subform, I have also created a field to show the calculated
latest date (strmaxdate) that is stored in the table for that particular
bridge. Up to now, everything was successful until I tried to write a
conditon macro to update the main form to show the latest date of the
"strMaxdate" date from each of the three subforms.


Assuming the max deck date is the greatest:
In the conditon field I wrote:


[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And
[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate]

In the setvalue Item field:
[Forms]![frm_Routine]![Inspection Date] ( Note: this is a unbound

field )


In the setvalue Expression field:
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate]

I wrote a condition for Superstructure and Substructure respectively in

the same Macro.....but in the main form [Inspection Date] field returns a
empty value.

I also tried to "single step" through the Macro when it runs but even

though the deck subform has the latest date then the other two subforms, it
still returns a "false" in the "single step condition" window....and I can't
adjust the single step window to see why it return false....


Any ideas what's wrong here? your support would be greatly appreciated.

Thanks
Pei



  #3  
Old July 8th, 2004, 04:22 PM
pei
external usenet poster
 
Posts: n/a
Default trouble with setvalue in form

Thanks Ken,

I tried the way you suggested, but it didn't work...I forgot to mention that I wrote a similar macro for my bridge inspection report and it worked. I don't know why it didn't work in form....any other ideas? Instead of using macros, what is the proper function (ie, Max, Dmax, Maxa, or Large...etc. ) I can use instead?

Also do you know how to adjust the size of the Macro single step window so that I can read all the message in the " condition window?

Thanks

Pei

"Ken Snell" wrote:

Using And the way you are, you're telling ACCESS to test if the
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate] *and*
if [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate] is True.

I believe you want to test if
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate] *and*
is greater than [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate].

Assuming this, change the condition statement to

[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Sub].[Form]![strMaxCondSubDate]


"Pei" wrote in message
...
Hi all

I am working on creating a inspection form for bridge inspectors. I have

created a main form with 3 additional subforms embedded in the main form
namely deck, superstructure and substructure. A field for date was created
in each of the subform for the inspector to log in when he is inspecting
that particular element of the bridge. Each time, the the logged date writes
back to separate tables which stores the date, and inspection information.
Within the same subform, I have also created a field to show the calculated
latest date (strmaxdate) that is stored in the table for that particular
bridge. Up to now, everything was successful until I tried to write a
conditon macro to update the main form to show the latest date of the
"strMaxdate" date from each of the three subforms.


Assuming the max deck date is the greatest:
In the conditon field I wrote:


[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And
[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate]

In the setvalue Item field:
[Forms]![frm_Routine]![Inspection Date] ( Note: this is a unbound

field )


In the setvalue Expression field:
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate]

I wrote a condition for Superstructure and Substructure respectively in

the same Macro.....but in the main form [Inspection Date] field returns a
empty value.

I also tried to "single step" through the Macro when it runs but even

though the deck subform has the latest date then the other two subforms, it
still returns a "false" in the "single step condition" window....and I can't
adjust the single step window to see why it return false....


Any ideas what's wrong here? your support would be greatly appreciated.

Thanks
Pei




  #4  
Old July 8th, 2004, 05:10 PM
Ken Snell
external usenet poster
 
Posts: n/a
Default trouble with setvalue in form

Assuming that your controls in the subforms have the correct values, then
the macro condition should work. So, perhaps I am not understanding your
setup. Can you provide some examples of data and such?

As for using a DMax function in place of what you're doing...well, let me
better understand what your setup is first.

No way to my knowledge to adjust the size of the macro step window.

--

Ken Snell
MS ACCESS MVP

"pei" wrote in message
...
Thanks Ken,

I tried the way you suggested, but it didn't work...I forgot to mention

that I wrote a similar macro for my bridge inspection report and it worked.
I don't know why it didn't work in form....any other ideas? Instead of
using macros, what is the proper function (ie, Max, Dmax, Maxa, or
Large...etc. ) I can use instead?

Also do you know how to adjust the size of the Macro single step window so

that I can read all the message in the " condition window?

Thanks

Pei

"Ken Snell" wrote:

Using And the way you are, you're telling ACCESS to test if the
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate]

*and*
if [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate] is True.

I believe you want to test if
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate]

*and*
is greater than

[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate].

Assuming this, change the condition statement to


[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And

[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Sub].[Form]![strMaxCondSubDate]


"Pei" wrote in message
...
Hi all

I am working on creating a inspection form for bridge inspectors. I

have
created a main form with 3 additional subforms embedded in the main form
namely deck, superstructure and substructure. A field for date was

created
in each of the subform for the inspector to log in when he is inspecting
that particular element of the bridge. Each time, the the logged date

writes
back to separate tables which stores the date, and inspection

information.
Within the same subform, I have also created a field to show the

calculated
latest date (strmaxdate) that is stored in the table for that particular
bridge. Up to now, everything was successful until I tried to write a
conditon macro to update the main form to show the latest date of the
"strMaxdate" date from each of the three subforms.


Assuming the max deck date is the greatest:
In the conditon field I wrote:



[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And
[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate]

In the setvalue Item field:
[Forms]![frm_Routine]![Inspection Date] ( Note: this is a

unbound
field )


In the setvalue Expression field:
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate]

I wrote a condition for Superstructure and Substructure respectively

in
the same Macro.....but in the main form [Inspection Date] field returns

a
empty value.

I also tried to "single step" through the Macro when it runs but even

though the deck subform has the latest date then the other two subforms,

it
still returns a "false" in the "single step condition" window....and I

can't
adjust the single step window to see why it return false....


Any ideas what's wrong here? your support would be greatly

appreciated.

Thanks
Pei






  #5  
Old July 8th, 2004, 06:45 PM
pei
external usenet poster
 
Posts: n/a
Default trouble with setvalue in form

thanks Ken,

In my "deck subform" the inspection dates for

deck 1 is 3/06/06 (fictitious date I used to test the program)
deck 2 is 3/20/05
deck 3 is 9/20/04

[strMaxDeckCondDate] with an control source =Max([tbl_Condition_Deck]![Inspection Date]) return 3/06/06 in the subform (which is correct !)


In my "Super Subform" the inspection dates for

Super 1 is 9/30/04
Super 2 is 2/08/04
Super 3 is 8/09/04

[strMaxSuperCondDate] return 9/30/04

and

In my "Sub Subform" the inspection dates for

Sub 1 is 10/25/04(fictitious date I used to test the program)
Sub 2 is 10/25/04
Sub 3 is 10/25/04

[strMaxSubCondDate] return 10/25/04


Then, I wrote a macro to attach to the main form *Routine* to compare and pick out the latest date( [strMaxDeckCondDate] = 3/06/06 ,[strMaxSuperCondDate] = 9/30/04 and [strMaxSubCondDate] = 10/25/04)

I am expecting the macro to return the date 3/06/06 in the unbound cell [date of inspection] in the main form *Routine*. But I got a false condition when I run the single step macro and return a blank date.



"Ken Snell" wrote:

Assuming that your controls in the subforms have the correct values, then
the macro condition should work. So, perhaps I am not understanding your
setup. Can you provide some examples of data and such?

As for using a DMax function in place of what you're doing...well, let me
better understand what your setup is first.

No way to my knowledge to adjust the size of the macro step window.

--

Ken Snell
MS ACCESS MVP

"pei" wrote in message
...
Thanks Ken,

I tried the way you suggested, but it didn't work...I forgot to mention

that I wrote a similar macro for my bridge inspection report and it worked.
I don't know why it didn't work in form....any other ideas? Instead of
using macros, what is the proper function (ie, Max, Dmax, Maxa, or
Large...etc. ) I can use instead?

Also do you know how to adjust the size of the Macro single step window so

that I can read all the message in the " condition window?

Thanks

Pei

"Ken Snell" wrote:

Using And the way you are, you're telling ACCESS to test if the
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate]

*and*
if [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate] is True.

I believe you want to test if
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate]

*and*
is greater than

[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate].

Assuming this, change the condition statement to


[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And

[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Sub].[Form]![strMaxCondSubDate]


"Pei" wrote in message
...
Hi all

I am working on creating a inspection form for bridge inspectors. I

have
created a main form with 3 additional subforms embedded in the main form
namely deck, superstructure and substructure. A field for date was

created
in each of the subform for the inspector to log in when he is inspecting
that particular element of the bridge. Each time, the the logged date

writes
back to separate tables which stores the date, and inspection

information.
Within the same subform, I have also created a field to show the

calculated
latest date (strmaxdate) that is stored in the table for that particular
bridge. Up to now, everything was successful until I tried to write a
conditon macro to update the main form to show the latest date of the
"strMaxdate" date from each of the three subforms.


Assuming the max deck date is the greatest:
In the conditon field I wrote:



[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And
[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate]

In the setvalue Item field:
[Forms]![frm_Routine]![Inspection Date] ( Note: this is a

unbound
field )


In the setvalue Expression field:
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate]

I wrote a condition for Superstructure and Substructure respectively

in
the same Macro.....but in the main form [Inspection Date] field returns

a
empty value.

I also tried to "single step" through the Macro when it runs but even
though the deck subform has the latest date then the other two subforms,

it
still returns a "false" in the "single step condition" window....and I

can't
adjust the single step window to see why it return false....


Any ideas what's wrong here? your support would be greatly

appreciated.

Thanks
Pei







  #6  
Old July 9th, 2004, 12:59 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default trouble with setvalue in form

I'm guessing that your "dates" actually are string text values, and that the
comparison then is being done based on strings and not dates.

Try this as your one condition:

DateValue([Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate])Dat
eValue([Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate]) And
DateValue([Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate])Dat
eValue([Forms]![frm_R
outine]![fsub_Sub].[Form]![strMaxCondSubDate])


--

Ken Snell
MS ACCESS MVP



"pei" wrote in message
news
thanks Ken,

In my "deck subform" the inspection dates for

deck 1 is 3/06/06 (fictitious date I used to test the program)
deck 2 is 3/20/05
deck 3 is 9/20/04

[strMaxDeckCondDate] with an control source
=Max([tbl_Condition_Deck]![Inspection Date]) return 3/06/06 in the subform
(which is correct !)


In my "Super Subform" the inspection dates for

Super 1 is 9/30/04
Super 2 is 2/08/04
Super 3 is 8/09/04

[strMaxSuperCondDate] return 9/30/04

and

In my "Sub Subform" the inspection dates for

Sub 1 is 10/25/04(fictitious date I used to test the program)
Sub 2 is 10/25/04
Sub 3 is 10/25/04

[strMaxSubCondDate] return 10/25/04


Then, I wrote a macro to attach to the main form *Routine* to compare and

pick out the latest date( [strMaxDeckCondDate] = 3/06/06
,[strMaxSuperCondDate] = 9/30/04 and [strMaxSubCondDate] = 10/25/04)

I am expecting the macro to return the date 3/06/06 in the unbound cell

[date of inspection] in the main form *Routine*. But I got a false
condition when I run the single step macro and return a blank date.



"Ken Snell" wrote:

Assuming that your controls in the subforms have the correct values,

then
the macro condition should work. So, perhaps I am not understanding your
setup. Can you provide some examples of data and such?

As for using a DMax function in place of what you're doing...well, let

me
better understand what your setup is first.

No way to my knowledge to adjust the size of the macro step window.

--

Ken Snell
MS ACCESS MVP

"pei" wrote in message
...
Thanks Ken,

I tried the way you suggested, but it didn't work...I forgot to

mention
that I wrote a similar macro for my bridge inspection report and it

worked.
I don't know why it didn't work in form....any other ideas? Instead of
using macros, what is the proper function (ie, Max, Dmax, Maxa, or
Large...etc. ) I can use instead?

Also do you know how to adjust the size of the Macro single step

window so
that I can read all the message in the " condition window?

Thanks

Pei

"Ken Snell" wrote:

Using And the way you are, you're telling ACCESS to test if the
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is

greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate]

*and*
if [Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate] is

True.

I believe you want to test if
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate] is

greater
than [Forms]![frm_Routine]![fsub_Super].[Form]![strMaxCondSuperDate]

*and*
is greater than

[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate].

Assuming this, change the condition statement to



[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And


[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Sub].[Form]![strMaxCondSubDate]


"Pei" wrote in message
...
Hi all

I am working on creating a inspection form for bridge inspectors.

I
have
created a main form with 3 additional subforms embedded in the main

form
namely deck, superstructure and substructure. A field for date was

created
in each of the subform for the inspector to log in when he is

inspecting
that particular element of the bridge. Each time, the the logged

date
writes
back to separate tables which stores the date, and inspection

information.
Within the same subform, I have also created a field to show the

calculated
latest date (strmaxdate) that is stored in the table for that

particular
bridge. Up to now, everything was successful until I tried to write

a
conditon macro to update the main form to show the latest date of

the
"strMaxdate" date from each of the three subforms.


Assuming the max deck date is the greatest:
In the conditon field I wrote:




[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate][Forms]![frm_R
outine]![fsub_Super].[Form]![strMaxCondSuperDate] And
[Forms]![frm_Routine]![fsub_Sub].[Form]![strMaxCondSubDate]

In the setvalue Item field:
[Forms]![frm_Routine]![Inspection Date] ( Note: this is a

unbound
field )


In the setvalue Expression field:
[Forms]![frm_Routine]![fsub_deck].[Form]![strMaxCondDeckDate]

I wrote a condition for Superstructure and Substructure

respectively
in
the same Macro.....but in the main form [Inspection Date] field

returns
a
empty value.

I also tried to "single step" through the Macro when it runs but

even
though the deck subform has the latest date then the other two

subforms,
it
still returns a "false" in the "single step condition" window....and

I
can't
adjust the single step window to see why it return false....


Any ideas what's wrong here? your support would be greatly

appreciated.

Thanks
Pei









 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching Records Melissa Lambino New Users 6 July 20th, 2004 04:51 AM
Modal form Praveen Manne Using Forms 1 July 6th, 2004 10:49 PM
Modal form Praveen Manne General Discussion 1 July 6th, 2004 10:49 PM
Recordset in subform based on field in parent form Lyn General Discussion 15 June 14th, 2004 03:10 PM
surely a form with a ListBox can be used in a query? 1.156 Running & Setting Up Queries 14 June 2nd, 2004 04:54 PM


All times are GMT +1. The time now is 08:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.