How to use a temporary viarable for two fields?

  • Thread starter Thread starter Megaton
  • Start date Start date
M

Megaton

Hello, I have been stuck at a circular reference problem for a while now and
I am trying to use a temporary viarable to transfer data between two fields
to solve this. Is there a way to do this? Any help is appreciated.
 
Dim varTemp As Variant

varTemp = Me!Control1
Me!Control1 = Me!Control2
Me!Control2 = varTemp
 
Thank you Douglas

May I ask where should I put these statements? It doesn't seem working in
the expression builder of the control source

Thanks
 
That's VBA code. You need to set the property for whatever event you're
trying to attach this to to [Event Procedure], then click on the ellipsis
(...) to the right of the property to be taken into the VB Editor, in the
middle of a block of code that will have a line like the following at the
beginning

Private Sub NameOfControl_NameOfEvent(...)

(where NameOfControl and NameOfEvent will be set depending on your
application, and the ... may or may not contain something, depending on the
specific event)

and

End Sub

at the end.

You put the code I gave you between those two lines.
 
Back
Top