bound and unbound textboxes (1 Viewer)

NewfieSarah

Registered User.
Local time
Today, 05:30
Joined
Feb 11, 2005
Messages
193
hey all i was wondering, can a unbound text box be a bound textbox. I have just noticed that my unbound text box doesnt not save in the field in my table, that is because it is unboune right? but i need it to save to my table, and i guees the only way to do that is to save in in the save button right? thanks
 

KenHigg

Registered User
Local time
Today, 04:00
Joined
Jun 9, 2004
Messages
13,327
Sarah, Simply set the text box's 'Control Source' property to the field you want the data saved to... (Or am I missing something here?)
 

Ron_dK

Cool bop aficionado
Local time
Today, 10:00
Joined
Sep 5, 2002
Messages
2,141
NewfieSarah said:
.
.
I have just noticed that my unbound text box doesnt not save in the field in my table, that is because it is unboune right? but i need it to save to my table, and i guees the only way to do that is to save in in the save button right?

If the textbox on your form is unbound and is used as a calculation, you should not save the data of that textbox. If you want to bind the textbox
change the control source property as suggested by Ken.
 

NewfieSarah

Registered User.
Local time
Today, 05:30
Joined
Feb 11, 2005
Messages
193
yes my textbox is unbound, I am using it in a calculation. However I need to save the data as well. ok let me explain a bit more. I have a Visa purchasing table and form. However I know the total cost and once that is entered then the calculations for hst and net cost develope. I have that part working. Now I just need to save the hst and the net cost in the fields however those textboxes are unbound because of the calcualtions. Ideas? Thanks
 

KenHigg

Registered User
Local time
Today, 04:00
Joined
Jun 9, 2004
Messages
13,327
I think the general consensus around here is going to be to 'Not' save it but rather simply calculate it on the fly whenever you need it...
 

NewfieSarah

Registered User.
Local time
Today, 05:30
Joined
Feb 11, 2005
Messages
193
Well I need to save the data, any ideas on how to do this would be great. to be blunt since this is my program I would like to save the data, I just need a bit of help to do that. Thanks
 

KenHigg

Registered User
Local time
Today, 04:00
Joined
Jun 9, 2004
Messages
13,327
Hum... I'm thinkin' that you need to have a fld in the table for the value and bind a text box on the form to it. Then if you're using two other text boxes to calculate the value, you would need to place code in each of the two other text boxes 'AfterUpdate' events that would calculate the new value after either of the other values change...

Make sense?
 

NewfieSarah

Registered User.
Local time
Today, 05:30
Joined
Feb 11, 2005
Messages
193
Thanks for the help all however, I have found the solution, for other peoples benifit here it is:
Me.HSTREBATE1.Value = Me.HSTREBATE.Value
Me.NETCOST1.Value = Me.NETCOST.Value
This is the code I added to the save button, or the exit of my TOTALCOST. here i have 4 textboxes instead of 2 and 2 are invisable which hold the calculation and then here in this code it is passes from the hidden to the visiale one and saved in the table.
 

IgorB

Registered User.
Local time
Today, 09:00
Joined
Jun 4, 2003
Messages
183
1) Create a new field in your table with name "TotalCalc"
2) On close button place code

Docmd.RunSql "Update YourTableName Set TotalCalc=Forms!YourFormName.YourCalculatedTextboxname where YourVisaUniqueField=Forms!YourFormName.YourVisaUniqueTextboxname"

Another word you are forceing to update field in a table using unbound calc. text on form.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:00
Joined
Feb 19, 2002
Messages
43,302
IgorB, running an update query from within a form's code module that will update the form's current record can lead to update conflicts and is not recommended.

Well I need to save the data, any ideas on how to do this would be great. to be blunt since this is my program I would like to save the data
With a gun in one hand and bullets in the other, you are asking us how to load the gun so you can shoot yourself in the foot. You have been given good advice and have chosen to ignore it.
 

Users who are viewing this thread

Top Bottom