Drag and Drop Switch

J

Joel

I have Drag and Drop working for my forms, but is there a way to switch the
values in the 2 textboxes when you drop n drag?

EX:

tbOne = 1 tbTwo = 2 after drag and drop from tbTwo to tbOne would normaly
be tbOne = 2 and tbTwo = 2.

I would like it to do this;

tbOne =1 tbTwo =2 after drag and drop from tbTwo to tbOne
tbOne -2 and tbTwo = 1

Thanks!
 
6

'69 Camaro

Hi, Joel.
I have Drag and Drop working for my forms, but is there a way to switch the
values in the 2 textboxes when you drop n drag?

No. However, two bound text box values could be swapped with each other as
the result of an event, such as a button being selected. For example:

Private Sub SwapBtn_Click()

On Error GoTo ErrHandler

Me!txtOne.Value = Me!txtTwo.Value
Me!txtTwo.Value = Me!txtOne.OldValue

Exit Sub

ErrHandler:

MsgBox "Error in SwapBtn_Click( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub


HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
D

Douglas J Steele

It may be worth pointing out that only bound controls have an OldValue
property. For unbound controls, you have to store the previous value
yourself.
 

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