Pulling info from one form to another???

louisa

Registered User.
Local time
Today, 11:20
Joined
Jan 27, 2010
Messages
262
Hi everyone,

I have a tabbed form and for the invoicing part i would like it so that if data is added to my text box it is also duplicated in another box on another tab on my form although this is duplicated data i do need to have it on both forms so instead of having to enter twice would just like it to extract and store in the other field. Any ideas would be great.

Many thanks
 
As long as you don't intend to store the same data twice in different table sin your app then this approach is fine. You can do it in several way, but the best is to have your target control as an unbound control on your form and in the after update of your source textbox state:

Me.TxtTarget = Me.TxtSource

In addition make the target control disabled and locked.

You may also need to put this on the On current event of the form also.

David
 
I'm a little confused, a tabbed form is simply a way of giving a form more real estate for a given size. So there should be no reason why you can't have text boxes, on a number of tabs, that all have the same Control Source
 
Thank you for your help.
Basically in my invoices form i have text boxes for One-off Charges, Recurring Charges and monthly invoices, 9 x out of 10 there will only be a Recurring charge so the monthly invoice will have the same value as the Recurring charge so i want the data entered in to Recurring to be added to the Monthly invoice box. (preferably i would love to have a tick box or something and if selected is then duplicated) not sure how difficult that would be and i am a newbie.

Many thanks
 
It would be fairly straight forward to duplicate the value of one text box into another based on a check box, something like;

Code:
If Me.CheckName = -1 Then
     Me.TextBox2 =  Me.TextBox1
Else
     Me.TextBox2 = 0 [COLOR="SeaGreen"]'Or whatever the default should be[/COLOR]
End If
In the On Click event of the Check Box.
 
Well i gave it a go, unfortunately i could not get it to work :-(
 
It's all good and well saying "It did not work" what did not work? what happened? did you get an error message? did you get anything?

David
 
I didn't get an error and it did not move the data.
 
Silly question, but, I'm guessing you changed the names to match those of your controls?
 
Private Sub Check8_Click()
If Me.Check8 = -1 Then
Me.Amount = Me.Amount

Else

Me.Amount = 0
End If
End Sub
 
OK as the code currently stands;
Code:
Private Sub Check8_Click()
If Me.Check8 = -1 Then
     Me.Amount = Me.Amount

Else

     Me.Amount = 0
End If
End Sub
You are setting the field Amount to equal itself :confused: so if it has zero value initially it will always equal zero. I thought you had two distinct text boxes, and that the second would equal the first when the check box was clicked.
 
You have got a circular reference

You are saying x = x

Me.Amount = Me.Amount

If you want to set the amount to 0 if the user unchecks the box then test for that only. A downfall to that is that if the user unchecks the box and it sets it to zero and the user decides to check the box the control does no know where to get the value from.

David
 
oh i see, i do have two text boxes but both are Amount in seperate forms???
 
Additionally do they share the same Control Source? or do they each have their of Control Source?
 
BJB They must be on different forms as Access would detect it. Therefore she needs the following code

Me.Amount = Forms("OtherFormName")("Amount")

This is assuming the other form is open of course.

David
 

Users who are viewing this thread

Back
Top Bottom