Cannot Edit Table fields in form?

pullmyefinger

Registered User.
Local time
Today, 15:08
Joined
Feb 26, 2011
Messages
37
I have two tables that i am trying to put in a form. The first one works cbolocations/qrylocations,

but the Equipment table does not. I added the table to the form as a query and changed the control sources for each textbox to bind the textboxes to the appropriate fields, but I cannot edit or save them.

I also need to be able to store information in "global variables" across event procedures cbo/afterupdate event, and access them in another table to automatically store/write those values for the user..

Tables: tbllocations and Eqpt (in Form1)

in tbllocations I need to say:

somevar1=!seqnum (the value in the seqnum field)
somevar2=!loccode(the value in the loccode field)

Then close tbllocations and open the Eqpt table and:

Seqnum(in eqpt table) = somevar1
loccode(in eqpt table) = somevar2

Itemcode(in eqpt table) = somevar2 + CStr(somevar1)

Then finish adding all the info to the textboxes and save the record.


I cannot figure out why the fields are giving me #Name? in the textboxes when I set the control source and added a new record?????



I thought i uploaded the .mdb but it does not show on here anywhere..
 
Last edited:
The table is not a separate reference. You can only refer to fields in the RecordSource query. The ControlSouce must refer to the field exactly as it is named. If the fieldname is unique in the query it will not include the tablename.

BTW. When refering to an object in a form the Control by the name is the default. If a control is not found the reference will to move to the recordset field.

If you want to refer directly to the field in the recordset use Me.Recordset!fieldname
 
ok, i understand that having to refer to a table is not required unless the field exists in another table of the dbf?

I understand the last sentence, but the BTW lines and other stuff make no sense all. As mentioned, this is the first endeavor with access.

I had other people try to help but only bits and pieces were understandable. All I have is a bunch of dots with very few connected.

I tried uploading the mdb 3 times but it won't do it.
 
I tried uploading the mdb 3 times but it won't do it.

Have you

1. Run Compact and Repair

and

2. ZIPPED the file.

Make sure when you get the dialog for uploading that you actually click the upload button when you have selected the file (many people miss that part). If it is successful it will show a link just below the text box which had the filepath/name for the file to upload, after you have hit the upload button and it has uploaded).
 
I understand the last sentence, but the BTW lines and other stuff make no sense all. As mentioned, this is the first endeavor with access.

The form has a "Recordset". This contains the records retreived by the "RecordSource" (a query or table). The Recordset had "Fields".

The boxes on the form are called "Controls". The Controls have a "ControlSource". If the Control is "Bound", the ControlSource is the name of the Field in the Recordset that the Control displays.

When a form is made using the Wizards, the Control and the Recordset Field have the same name. However a Control can be bound to a Field with a different name if you choose to do so.

When you refer to an object on the form (eg Me.SomeName) Access first looks for a Control with that name. If it doesn't find it then it will refer to Field in the Recordset using that name.

This is because Me.SomeName is actually shorthand for two different references. The first is the default.

Me.Controls.Somename and Me.Recordset.SomeName

This is not obvious to new developers who often initially assume that the two are the same thing. It becomes obvious when working with unbound controls. The field and control can still have the same name but the developer must be aware of the referencing heirarchy. Sometimes the dame name is convenient, others a different name is a better choice.

Unbound controls allow anthing to be entered. VBA can be used to set the value to a field from the recordset or anything else the developer cares to put in it. When it comes time to save the records, the value in the control can be written to the field using VBA.

Why would a developer do this? This technique allows a control to look and behave like it is bound but for one crucial difference. A value typed into the control can be used to find a different record instead of changing the value in the current record. Just needs a bit of VBA.
 
GOOD, BASIC Explanation!! You read the part that said I was new to this and wrote accordingly.

This will help because I did not know what needed to go in a form/control and what needs to be played with in VBA. Big Help, Thank You..
 

Users who are viewing this thread

Back
Top Bottom