Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Form Is Read Only

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
boyratchet - 25 Feb 2008 13:39 GMT
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?
Carl Rapson - 26 Feb 2008 15:36 GMT
>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
boyratchet - 04 Mar 2008 10:44 GMT
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.


>>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 - 18 lines]
>
>Carl Rapson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.