Newbie Moving Text between Data bound textboxes 
Author Message
 Newbie Moving Text between Data bound textboxes

Greetings,

I really need help with this. I hope you are willing and able to help me :)

I have 2 textboxes let's call them Text1 and Text2 :)
Both are Data Bound (Using the DataEnviroment)

The difference between them is that they are bound to different recordsets.

Text1 should hold the data, but it can happen that it's empty. If this is
the case I want it to look at Text2 and retrieve the data from that box.

What I need help with is, how do I copy the (database) data from one textbox
to another.

Something similar as to:  Text1.text = Text2.text (this doesn't work with
data bound controls)

PLEASE help me with this

Yours,

Kevin



Sat, 24 May 2003 10:53:45 GMT  
 Newbie Moving Text between Data bound textboxes
You can try updating the bound recordset, rather than the text box:

de1.rstext1("MyTextField1") = text2.text

Pieter


Quote:
> Greetings,

> I really need help with this. I hope you are willing and able to help me
:)

> I have 2 textboxes let's call them Text1 and Text2 :)
> Both are Data Bound (Using the DataEnviroment)

> The difference between them is that they are bound to different
recordsets.

> Text1 should hold the data, but it can happen that it's empty. If this is
> the case I want it to look at Text2 and retrieve the data from that box.

> What I need help with is, how do I copy the (database) data from one
textbox
> to another.

> Something similar as to:  Text1.text = Text2.text (this doesn't work with
> data bound controls)

> PLEASE help me with this

> Yours,

> Kevin



Sat, 24 May 2003 03:00:00 GMT  
 Newbie Moving Text between Data bound textboxes
Kevin:

Let's say you have 2 ADO DataControls (Adodc1 and Adodc2)  feeding
Text1 and Text2 respectively. Somewhere in your code (I need more
details to be able to say exactly where) you could check the status of
the Adodc1.RecordSet.EOF property:

If Adodc1.RecordSet.EOF Then
 Set Text1.DataSource = Adodc2
 Text1.DataField="SomeFieldInTheAdodc2Recordset"
 Text1.Refresh
else
 Set Text1.DataSource = Adodc1
 Text1.DataField="SomeFieldInTheAdodc1Recordset"
End If

bear in mind, however, that when Adodc1.RecordSet.EOF you will be
updating the Adodc2.RecordSet !!

*Alternately*, if you indeed want to transfer the data displayed in
Text2 to Text1, then you'll need to update the underlying recordset
"behind" Text1:

If Adodc1.RecordSet.EOF Then
 Adodc1.RecordSet.AddNew
 Adodc1.RecordSet("SomeFieldInTheAdodc1Recordset") = _
 Adodc2.RecordSet("SomeFieldInTheAdodc2Recordset")
 Text1.Refresh
End If

Regards,
-Toby

On Tue, 5 Dec 2000 03:53:45 +0100, "Kevin Schaaps"

Quote:

>Greetings,

>I really need help with this. I hope you are willing and able to help me :)

>I have 2 textboxes let's call them Text1 and Text2 :)
>Both are Data Bound (Using the DataEnviroment)

>The difference between them is that they are bound to different recordsets.

>Text1 should hold the data, but it can happen that it's empty. If this is
>the case I want it to look at Text2 and retrieve the data from that box.

>What I need help with is, how do I copy the (database) data from one textbox
>to another.

>Something similar as to:  Text1.text = Text2.text (this doesn't work with
>data bound controls)

>PLEASE help me with this

>Yours,

>Kevin



Sat, 24 May 2003 03:00:00 GMT  
 Newbie Moving Text between Data bound textboxes
So what's wrong with
on error go somewhere else
dim temp as variant
if text1.text = " "   then  ' or use isnull function
temp = text2.text
text1.text = temp
else
end if

member of KISS
"Keep It Simple Stupid!"

--



Quote:
> Greetings,

> I really need help with this. I hope you are willing and able to help me
:)

> I have 2 textboxes let's call them Text1 and Text2 :)
> Both are Data Bound (Using the DataEnviroment)

> The difference between them is that they are bound to different
recordsets.

> Text1 should hold the data, but it can happen that it's empty. If this is
> the case I want it to look at Text2 and retrieve the data from that box.

> What I need help with is, how do I copy the (database) data from one
textbox
> to another.

> Something similar as to:  Text1.text = Text2.text (this doesn't work with
> data bound controls)

> PLEASE help me with this

> Yours,

> Kevin



Sun, 25 May 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Newbie Moving Text between Data bound textboxes

2. Newbie Moving Text between Data bound textboxes

3. how to use textbox 's scrollbar auto move text in textbox

4. Newbie Question - Moving from text box to text box (without tab)

5. Data-bound Masked Edit makes all data-bound controls not display data

6. VB4: Closing data bound form leaves cursor moving

7. How to move text from a textbox to label

8. bind textbox.text to a class property

9. Data Bound Combo Box within a Data Bound Grid

10. Data bound Combos or Not Data Bound Combos

11. Data-Bound Vs. Non-Data-Bound Controls

12. Data-Bound Vs. Non-Data-Bound Controls

 

 
Powered by phpBB® Forum Software