A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form Is Read Only



 
 
Thread Tools Display Modes
  #1  
Old February 25th, 2008, 01:39 PM posted to microsoft.public.access.forms
boyratchet via AccessMonster.com
external usenet poster
 
Posts: 10
Default Form Is Read Only

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?

--
Message posted via http://www.accessmonster.com

  #2  
Old February 26th, 2008, 03:36 PM posted to microsoft.public.access.forms
Carl Rapson
external usenet poster
 
Posts: 517
Default Form Is Read Only

"boyratchet via AccessMonster.com" u41080@uwe wrote in message
news:8042e133536aa@uwe...
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?

--
Message posted via http://www.accessmonster.com


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


  #3  
Old March 4th, 2008, 10:44 AM posted to microsoft.public.access.forms
boyratchet via AccessMonster.com
external usenet poster
 
Posts: 10
Default Form Is Read Only

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 Rapson wrote:
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


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.