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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|