Can't edit record - Form is read-only

  • Thread starter boyratchet via AccessMonster.com
  • Start date
B

boyratchet via AccessMonster.com

I have a Students form that has as its record source the Students table. It
has sub form which displays a list of the classes the student has take/is
taken along with the name of the teacher and a status flag, StatusID. The
Classes.StatusID is a foreign key linked to the Status table. By clicking a
button, the classes form is displayed with the record source being a query
that reflects all of the classes shown on the Students form. The Students
form is still open in the background.

Here is the query and the code behind the button.

strSQL = "SELECT Classes.* " _
& "FROM Classes INNER JOIN [Students And Classes] " _
& "ON [Students And Classes].ClassID = Classes.ClassID " _
& "WHERE [Students and Classes].StudentID = " _
& Me.StudentID

With rsClasses
Set .ActiveConnection = cnALCM
.Source = strSQL
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open
End With

The problem occurs when I try to change the status (a combo box bound to
StatusID with a lookup to the Status table) or any other data on the classes
form. I receive a message on the status bar, telling me that the "Form is
read-only". I have no real idea what is going on here, so can anybody help?
 
M

MichaelRay via AccessMonster.com

Check out this MS article on updates in one-to-many queries. Also make sure
you have primary keys on both tables.
http://support.microsoft.com/kb/328828
I have a Students form that has as its record source the Students table. It
has sub form which displays a list of the classes the student has take/is
taken along with the name of the teacher and a status flag, StatusID. The
Classes.StatusID is a foreign key linked to the Status table. By clicking a
button, the classes form is displayed with the record source being a query
that reflects all of the classes shown on the Students form. The Students
form is still open in the background.

Here is the query and the code behind the button.

strSQL = "SELECT Classes.* " _
& "FROM Classes INNER JOIN [Students And Classes] " _
& "ON [Students And Classes].ClassID = Classes.ClassID " _
& "WHERE [Students and Classes].StudentID = " _
& Me.StudentID

With rsClasses
Set .ActiveConnection = cnALCM
.Source = strSQL
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open
End With

The problem occurs when I try to change the status (a combo box bound to
StatusID with a lookup to the Status table) or any other data on the classes
form. I receive a message on the status bar, telling me that the "Form is
read-only". I have no real idea what is going on here, so can anybody help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top