Form Is Read Only

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

boyratchet via AccessMonster.com

I know that this has been discussed here before, but those posting the
original question never seemed to follow though when asked for further
information, so in reading these previous postings, I have felt a little lost.


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?
 
C

Carl Rapson

boyratchet via AccessMonster.com said:
I know that this has been discussed here before, but those posting the
original question never seemed to follow though when asked for further
information, so in reading these previous postings, I have felt a little
lost.


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?

I'm not overly familiar with ADO, but it sounds to me like your query might
be non-updatable. If you create a query using the same SQL code
(substituting some value for the student id), is the query updatable? If
not, you may need to re-think your design. Instead of a "pop-up" Classes
form, can you imbed the Classes form into the Students form as a subform?
Then there whould be no need to use a joined query; just set the subform
control's Link Master and Link Child fields to create the link between your
main form and subform. Then all classes will be automatically displayed when
a student record is displayed.

If the query itself is updatable, then I would check the Allow Edits
property of the Classes form. Maybe that property got set to No somehow.

HTH,

Carl Rapson
 
B

boyratchet via AccessMonster.com

There is already a subform that shows only certain fields, which I had set so
that it wouldn't be updateable. I changed that, but as I still needed access
to other data on the Classes form, I simply created a routine that constructs
a WHERE clause and uses it as a filter when opening the form with the DoCmd
object.

Set rs = Forms![Students]![Students Subform].Form.RecordsetClone
rs.MoveFirst

strSQL = "ClassID IN ("
For i = 1 To rs.RecordCount
strSQL = strSQL & rs.Fields("ClassID")
If i <> rs.RecordCount Then
strSQL = strSQL & ", "
rs.MoveNext
Else
strSQL = strSQL & ")"
End If
Next i

DoCmd.OpenForm "Classes", acNormal, , strSQL

This seems to work.


Carl said:
I know that this has been discussed here before, but those posting the
original question never seemed to follow though when asked for further
[quoted text clipped - 33 lines]
read-only". I have no real idea what is going on here, so can anybody
help?

I'm not overly familiar with ADO, but it sounds to me like your query might
be non-updatable. If you create a query using the same SQL code
(substituting some value for the student id), is the query updatable? If
not, you may need to re-think your design. Instead of a "pop-up" Classes
form, can you imbed the Classes form into the Students form as a subform?
Then there whould be no need to use a joined query; just set the subform
control's Link Master and Link Child fields to create the link between your
main form and subform. Then all classes will be automatically displayed when
a student record is displayed.

If the query itself is updatable, then I would check the Allow Edits
property of the Classes form. Maybe that property got set to No somehow.

HTH,

Carl Rapson
 

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