Uneditable textbox (1 Viewer)

mcalex

Registered User.
Local time
Today, 13:36
Joined
Jun 18, 2009
Messages
141
Solved: Uneditable textbox

Hi all

I have a form that when opened will either allow new records to be added, or allow existing records to be viewed, depending on the OpenArgs. When existing records are being viewed, the user can click an 'Edit' button to allow that record to be edited. In add mode the text boxes look like text boxes, in view mode, I have set them to look like labels (using BackStyle, BorderStyle, etc)

Apart from changing the text boxes, clicking the Edit button also sets the form to AllowEdits. I thought I had this working, but when I was using it today, I noticed that the edit button functionality wasn't working, and the text boxes remain uneditable (the cosmetic stuff still works).

I have checked that the text box is Enabled, and not Locked. I have confirmation that the form has AllowEdits set to True. I have also ensured that the Form's RecordSetType is a DynaSet (not a Snapshot). I can't think of any other properties that would result in this behaviour.

Can anyone give any further ideas on what could stop could stop me editing the data in a textbox?

many thanks

mcalex
 
Last edited:

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:36
Joined
Sep 12, 2006
Messages
15,653
is the recordset (query) the form is based, editable.

open it directly, and see if you can change stuff. If you can't then that is the problem.

In which case, search for "recordset not updateable".
 

mcalex

Registered User.
Local time
Today, 13:36
Joined
Jun 18, 2009
Messages
141
Thanks guys

searching 'uneditable recordsets' as we speak :)
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:36
Joined
Sep 12, 2006
Messages
15,653
out of interest - if the recordset is not editable, it won't let you add new records either.

maybe you changed the query recently?
 

mcalex

Registered User.
Local time
Today, 13:36
Joined
Jun 18, 2009
Messages
141
OK, the adding 'query'/RecordSource is just the table, but the editing query/RecordSource is a query based on the existing entries in the table.

I'm dealing with an annual survey form sent to existing customers. Basically, the form is a 1 to 1 mapping to the table, but there are some links to foreign key data for the purpose of meaningful information (eg, so the users can add or edit John Smith's record, not 53601's, or look up data from 2010/11, not 7).

When adding (RecordSource=Table), the customer combo uses a query to populate the customer list with all customers, allowing the user to select the correct id by choosing the correct name. When editing (RecordSource=Query), the query needs to have the customer combo only populate the customer list with those that have submitted the form.

The reason I am writing everything out like this is because the fixes to the uneditable recordset problem don't seem to apply to me: there are no aggregate functions occurring, all my tables have primary keys (I'm not even sure I could create a table without a primary key-ewww), and all the relationship joins are on index fields. The only 'oddity' (perhaps) is that the query selects '*' from the main table, and the name fields from the linked table. Could the * be hurting things?

I need to investigate further, but right now, I'm stumped

mcalex
 

mcalex

Registered User.
Local time
Today, 13:36
Joined
Jun 18, 2009
Messages
141
okies, worked it out

It was a primary key issue. The query - and others - includes a linked table in a Sql Server database. The Sql server was moved from one box to another a while back, and therefore, I had updated the linked table with the dsn connection to the new box. When I did this I got a dialog box reading: 'All linked tables were successfully refreshed' which lulled me into a false sense of security. The relinking didn't include the reinstatement of the primary key, and so, even though the query worked (the limit of my testing at the time), it stopped being updateable.

Solution: I had to delete the linked table from the tables list in the database window, and then use File/Get External Data/Link tables to get to the bit where I tell access what the table's primary key is. Then I had to check every query using that table, as some didn't work (but that may have been due to my diagnostic efforts earlier in the process)
 

Users who are viewing this thread

Top Bottom