COMPARING VALUES IN FORM/SUBFORM

P

pauld

I have a Form/SubForm where I use the contents of certain fields on the
SubForm to validate the accuracy of corresponding fields on the Form. The
sources of the 2 Forms are different Tables.

I'd like to be able to change the contents of the field on the Form if the
contents of that field on the SubForm indicates a different value. The
Subform field data is the "official" values and the data on the Form is not.

I thought I could simply run a Macro using SetValue with the destination
being the field on the Form and the expression being [Forms]![SUBFORM]![FIELD
NAME], but that doesn't work.

I'd appreciate some ideas on how to do this using MS Access Macro commands.
I'm not at all familiar with other methods.

Thanks.
 
W

Wayne-I-M

Action = SetValue
Item = [Forms]![MainFormName]![MainFormControl]
Exression = [Forms]![MainFormName]![SubFormName].[Form]![SubFormControl]

Or

Forms!MainFormName!MainFormControl=
Forms!MainFormName!SubFormName.Form!SubFormControl

This would be better but not sure how you are getting your numbers.
ie.
SubFormControl (or MainFormControl) AfterUpdate
If they are not equal
Message do you want to change the main form control
No = Do nothing
Yes = Change the main form control

etc
etc
 
P

pauld

Thanks....I see that I was close, but there is still a problem .

The name of the main form is EDIT INCOMPLETE ENTRIES

The name of the SubForm is FIND PHRF

When I launched the Macro, I got an error mesage that says "The Object you
referenced in the visual Basic prodecure as an OLE object isn't an OLE object"

I noticed your Main Form and Sub Form Names were run together. Does it
matter that my Main Form and Sub Form names are all in caps and separate
words ?

I want this to be a manual process so I have a Command button on the Main
Form that I will ckick only when I see that the two fields have a different
value.

Wayne-I-M said:
Action = SetValue
Item = [Forms]![MainFormName]![MainFormControl]
Exression = [Forms]![MainFormName]![SubFormName].[Form]![SubFormControl]

Or

Forms!MainFormName!MainFormControl=
Forms!MainFormName!SubFormName.Form!SubFormControl

This would be better but not sure how you are getting your numbers.
ie.
SubFormControl (or MainFormControl) AfterUpdate
If they are not equal
Message do you want to change the main form control
No = Do nothing
Yes = Change the main form control

etc
etc


--
Wayne
Manchester, England.



pauld said:
I have a Form/SubForm where I use the contents of certain fields on the
SubForm to validate the accuracy of corresponding fields on the Form. The
sources of the 2 Forms are different Tables.

I'd like to be able to change the contents of the field on the Form if the
contents of that field on the SubForm indicates a different value. The
Subform field data is the "official" values and the data on the Form is not.

I thought I could simply run a Macro using SetValue with the destination
being the field on the Form and the expression being [Forms]![SUBFORM]![FIELD
NAME], but that doesn't work.

I'd appreciate some ideas on how to do this using MS Access Macro commands.
I'm not at all familiar with other methods.

Thanks.
 
P

pauld

I'm not sure of the protocol for asking for more help with this problem.

Do I "wait and see" if others will respond or do I re-post the issue as a
new question ?

I'd like to use a simple SetValue macro to "copy' a value in a field of a
subform to a corresponding field on the main form

Main Form is named EDIT INCOMPLETE ENTRIES

Subform is named FIND PHRF

I must be using the wrong Item and Expression because I get an error about
trying to reference an Ole object that isn't an Ole object.

Thanks foir help !

pauld said:
Thanks....I see that I was close, but there is still a problem .

The name of the main form is EDIT INCOMPLETE ENTRIES

The name of the SubForm is FIND PHRF

When I launched the Macro, I got an error mesage that says "The Object you
referenced in the visual Basic prodecure as an OLE object isn't an OLE object"

I noticed your Main Form and Sub Form Names were run together. Does it
matter that my Main Form and Sub Form names are all in caps and separate
words ?

I want this to be a manual process so I have a Command button on the Main
Form that I will ckick only when I see that the two fields have a different
value.

Wayne-I-M said:
Action = SetValue
Item = [Forms]![MainFormName]![MainFormControl]
Exression = [Forms]![MainFormName]![SubFormName].[Form]![SubFormControl]

Or

Forms!MainFormName!MainFormControl=
Forms!MainFormName!SubFormName.Form!SubFormControl

This would be better but not sure how you are getting your numbers.
ie.
SubFormControl (or MainFormControl) AfterUpdate
If they are not equal
Message do you want to change the main form control
No = Do nothing
Yes = Change the main form control

etc
etc


--
Wayne
Manchester, England.



pauld said:
I have a Form/SubForm where I use the contents of certain fields on the
SubForm to validate the accuracy of corresponding fields on the Form. The
sources of the 2 Forms are different Tables.

I'd like to be able to change the contents of the field on the Form if the
contents of that field on the SubForm indicates a different value. The
Subform field data is the "official" values and the data on the Form is not.

I thought I could simply run a Macro using SetValue with the destination
being the field on the Form and the expression being [Forms]![SUBFORM]![FIELD
NAME], but that doesn't work.

I'd appreciate some ideas on how to do this using MS Access Macro commands.
I'm not at all familiar with other methods.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top