Is there anyway to blank a text box on a form

helen85

Registered User.
Local time
Today, 00:51
Joined
Apr 6, 2007
Messages
33
Is there anyway to blank a text box on a form, so it will not add that textboxs data to a table? Thank you.:rolleyes:
 
It sounds like you're trying to describe an unbound textbox, one that's not bound to a table/query! Goto the menu and click on the icon ab| and place it on your form. What's the purpose of this textbox?
 
the purpose of it is to get a value from another textbox, via Dlookup, but because the textbox is form a different table its adding it in both tables and dont want that textbox to be added to the table.
 
the purpose of it is to get a value from another textbox, via Dlookup, but because the textbox is form a different table its adding it in both tables and dont want that textbox to be added to the table.

Dont tie the control source to anything. Just make the control source the formula necessary to display the information
 
ok this is the function,
=DLookUp("UserID","Comments","Name = '" & [Forms]![AddComments]![Name] & "'")

what should i change?
 
ok fix it, however the userID box which has the source Dlookup is adding the userID to the table as 0 instead of the value which it finds, how do i change it so the value which it finds it adds to my table?
 
SO I understand this, this text box you WANT to write the value to a table, or do NOT WANT to write the value in the text box to a table?
 
yes i do want the userID value to be entered into the table, but at the mo it comes up with 0 and not the value it finds with the Dlookup
 
If you have a DLookup as the Recordsource of the text box, then it isn't bound to the table and it won't store the data. If you want to have the DLookup to be there and then update the table, you should put a hidden text box on your form, bind it to the field and in the form's before update event, put:

Me.YourHiddenTextBoxName = Me.YourTextBoxNameWithTheDLookup
 
Silly question but was dose the Me. Standard for in the formula and how do I bind it to the field? Sorry new at this:D

Me. refers to the form i think?
 
Last edited:
Me an Access Keyword referring to the current form that an object, such as a text box, is attached to. It's a sort of shorthand notation for the form name. It keeps you from retyping the name for the form over and over again!

Me.ControlName is the same as FormName.ControlName.

And you have to do nothing to bind it to the control's name.
 
what have i done wrong when it errors, the expression may not result in the name of a macro, the name of a user-defined funtion, or event procedure?

this is what i have, in the before update event
=AddComments.txtName=AddComments.UserID
 
Get rid of the first equals sign:
Code:
AddComments.txtName = AddComments.UserID
 
yeap have done but it still saying the same, and my form is called AddComments
 
Is AddComments.UserID a the name of a text box on your form?
 
no, Addcomments is my form and userID is the text box, also again with the frist form and then textbox
 
...this is what i have, in the before update event
...
Is this in the FORM'S before update event or a control's before update event. It would need to be in the FORM's before update event.
 
yes its in the forms before update event, thats why i dont understand why its not working
 
Any way you can either post the database, or email it to me? You would need to Compact (Tools > Database Tools > Compact and Repair) and the zip it with WinZip (or something similar) to create a zipped file. You can post if the final zipped file is 393Kb or less. If too big, then you can PM me for my email address.
 
Okay, you have several issues going on. I am going to post a set of screenshots showing some of this and I'm going to show you something that you won't eventually need, in this case, but you should know about.

ev01.png


ev02.png


ev03.png


ev04.png


You won't actually need this code due to the controlsource of txtName.

ev05.png


ev06.png


ev07.png


ev08.png
 

Users who are viewing this thread

Back
Top Bottom