Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Q - Why does my text field in my form not update in the table? 1

Status
Not open for further replies.

shellj

Technical User
Sep 19, 2002
30
I have created a form to input data into a stock details table. I have numerous text fields and combo boxes which I use to update the table but data entered into 2 of my text fields does not display in the table.

These 2 fields are autofilled depending on what data is entered in previous fields, but apart from that I cannot see why these fields do not show in my table.

It's probably something very simple but I hope someone can help.

Thanks in advance
 
Hi!

In the forms design view, check the control source property on the data tab for these controls. If this isn't set, the table won't update.

Roy-Vidar
 
Thanks for the quick reply! The only problem I have is that each of these fields is already linked to a source to allow the autofill. For example, the field 'Group' has =Style.column(1) in the Control Source because it is dependent on what is entered in the Style field ie if 'Skirts' is entered in Style the Group autofills to '14'. I have a Style table where all these details are stored. The other field is a 'Code' field that is generated once the data has been entered to create a unique number ie 17-14-0001-02-03 (14 representing the group). The control source I have in this field is =Designer.Column(1) & [Group] & " " & Colour.column(1) & Size.column(1).

Is there another way that I can either autofill the fields as required or allow updates to the table?

Thanks again.


 
Okey - to do that, you'll probably have to do a bit of coding. But as long as the fields you are going to update are in the forms recordsource (they are?), it the code itself, shouldn't be difficult. It's only where.

I think I would use the forms on current event and place the following code there

if len(me!txtControl1 & "")>0 then
me!field1=me!txtControl1
endif
if len(me!txtControl2 & "")>0 then
me!field2=me!txtControl2
endif

HTH Roy-Vidar
 
Thanks RoyVidar, I'll give it a try!
 
BTW - you're saying you have "field 'Group'" and a field "Code". I strongly advice you to differensiate between text controls on a form/report and the recordsource of such, at least the controls you're going to manipulate in some way.

Standard naming convention is prefixing text controls with txt, labels lbl, combos cbo, command buttons cmb etc.

If you use the form wizard (which most of us do), MS. Access gives all the controls the same name as the fields, and that creates problems later on when, as here, you're going to assign values to the fields in THE TABLE.

So, if you're getting into trouble;-) consider this.

Roy-Vidar
 
Hi Roy-Vidar,

Thanks for your help - it worked a treat! I was having a problem with the naming of my fields in the table but changing them has worked!

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top