Access 2007 : using the expression builder

hi,
im using access 2007,
i have a sub form with fields "A" and "B" on it.
i want that after each change of value of "A", "B" will recivethe new value of  "A".
i managed doing it by writing a simple code, but i wish to know if there's a way to do so using the "Expression builder"?
i tried what to me seemed the obvious way:
after update of A : [B]=[A]
but thats not working.
is there a way?
thanks
Or_AAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Did you do this in the form's Code Module? The code for what you want is very simple:

Sub A_AfterUpdate()
  Me.B = Me.A
End Sub

I'm not sure how you'd do this with the Expression Builder ... I haven't used it for quite some time. However, there are many choices in the listboxes and such, and one of those choices allows you to choose the fields on the object you're working with. This would be where you'd locate those items. The EB is not very intuitive, however, and the code produced by it can sometimes be very arcane and difficult to follow. Learn the basics of VBA and you'll be waaaaaay ahead of the game.
0
Or_AAuthor Commented:
thanks for the comment,
as i said, i managed doing this using a VBA code. im allready familiar with VBA.
but i want to know if there's a way to do so in the arcaic Expression Builder...
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
As I said: I'm not entirely sure, nor am I clear as to why you'd want to use the Expression Builder if you're comfortable with VBA. That's a serious step back.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Jeffrey CoachmanMIS LiasonCommented:
If I am understanding your question correctly...
The Expression builder cannot "Code" anything:
<after each change of value of "A", "B" will recivethe new value of  "A".>
...If that is what you are asking.

(Can I ask, are you asking this out of curiosity or necessity?)

For example, If you select the expression builder from the change event of a control and wrote this:
If [Use Expression Builder to point to Student One Control]= "Jeff" then
    [Use Expression Builder to point to Student Two Control]="Bob"
end if
...You will get an "Invalid Syntax" error.

You can use it to "help" build your code, by "Building" the references to an Object and pasting it into your VBA code,... which is what it is designed to do.

The key word here is: "Expression" builder.
If you want to build code, use the "Code" builder.
;-)

Or perhaps I am not understanding something.
Can you provide a clear, complete example of something you coded that you want to duplicate with the expression builder?

JeffCoachman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Or_AAuthor Commented:
thanks
boag - i asked because i have a form with many controls in which i wanted to use the "after change" event to update other controls. (not 'if then' sentence as you suggested, but just copy the value to other control)
but you say that it's impossible, so i'll just use VBA code...
0
Jeffrey CoachmanMIS LiasonCommented:
I never said it was "Impossible"
I never like to speak in absolutes.
I will only go as far as saying that I, personally, have not ever seen this being done.
;-)

...so, out of curiosity, I tried it.

If you use the Expression Builder on the Change event of a TextBox named txtA, you will get something like this:
    =[txtB]=[txtA]
(Which is exactly what the code is, BTW ;-) )
When the Change event for that textbox fires, ...<Drumroll>.... nothing happens.
:-(


JeffCoachman
0
Jeffrey CoachmanMIS LiasonCommented:
... But I am still curious as to why you wanted to do this, as opposed to just using code (as LSM stated)
?
0
Or_AAuthor Commented:
just thought that it will be more sipmlify to use this kind of short writing (and fact is - you tried simple =[txtB]=[txtA] code) to do it, as i have lots of controls to use it. not some kind of special need or i dont know what :) but as i said, im taking all of you two advices and return to where it all began in this world - the VBA window!
0
Jeffrey CoachmanMIS LiasonCommented:
;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.