Solved

Form is read only even though query behind it is editable

Posted on 2008-10-22
17
269 Views
Last Modified: 2011-10-19
Why would my form be read only, even though I can edit the query that the form is based on? The form is a subform that is not linked to the master because it is populated based on what is selected in comboboxes on the main form. I fill the recordset of the subform programmatically based on what is selected. I can edit the query but cannot type into fields. The subform is enabled and not locked.
0
Comment
Question by:smoore6809
  • 8
  • 4
  • 3
  • +1
17 Comments
 
LVL 75
ID: 22779598
Check the AllowEdits propery - is it set to No?

mx
0
 

Author Comment

by:smoore6809
ID: 22779616
set to yes
0
 
LVL 16

Expert Comment

by:Sheils
ID: 22779632
You have to check and make sure that allow edit and allow addition is set to yes in both the form and subform
0
 

Author Comment

by:smoore6809
ID: 22779636
Here is an example of one of the combo box after update fields on the main form:

Private Sub txtBuyerCode_AfterUpdate()
  psWhereClause
  strSQL = "Select * " _
        & "    from qryBuyerReport " _
        & "   Where " & strWhere
          Set cnn = New ADODB.Connection
          cnn.Open pstrConnectionString
          Set rs = New ADODB.Recordset
              With rs
                              .Open Source:=strSQL, _
                        ActiveConnection:=cnn, _
                        CursorType:=adOpenKeyset, _
                        LockType:=adLockOptimistic
                 'CursorLocation:= adUseClient
                  If .RecordCount = 0 Then
                   MsgBox "No Records Found"
                  Else
                    Set Me.objSubform.Form.Recordset = rs
                    Me.objSubform.Form.Requery
                  End If
                  .Close
              End With
          Set rs = Nothing
          Me.cboItem = ""
          Me.cboVendor = ""
          DoCmd.Hourglass False
          cnn.Close
          Set cnn = Nothing
    'Me.frmDetail_SubTotal.Visible = False
End Sub
0
 

Author Comment

by:smoore6809
ID: 22779657
they are both set correctly
0
 
LVL 16

Expert Comment

by:Sheils
ID: 22779670
can you type in the subform when you open it outside the form
0
 

Author Comment

by:smoore6809
ID: 22779686
No, but I think it is because I don't set the recordsource until the main form is opened, so if I open it by itself I get #Name? in all of the fields
0
 
LVL 75
ID: 22779718
I know the query works, but can you post the SQL for the query?

mx
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:smoore6809
ID: 22779743
SELECT dbo_tvwBuyerReport.*, IIf([allowtype]="" Or IsNull([allowtype]),0,1) AS ysnAllow, IIf(IsNull([POQty]),0,1) AS ysnPO, IIf([ysnPO]=1 Or [ysnAllow]=1,1,0) AS ysnCmd, IIf([DaysAvailable]<>0,Round(([DaysAvailable]*[avg8wks]/5)-[qtyonhand]+0.49),"") AS DaysAvail
FROM dbo_tvwBuyerReport;
0
 
LVL 75
ID: 22779775
ok ... so, you cannot type into any fields?  Or select any thing from any combo box?

mx
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 22779927
try this changes, see if it will make any difference

          Set rs = New ADODB.Recordset
              With rs
                              .Open Source:=strSQL, _
                        ActiveConnection:=cnn, _
                        CursorType:=adOpenStatic, _
                        LockType:=adLockBatchOptimistic, _
                CursorLocation:= adUseClient
0
 

Author Comment

by:smoore6809
ID: 22779957
I get an error compile error named argument not found
0
 

Author Comment

by:smoore6809
ID: 22779971
please see attached
Doc2.doc
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 22780158
hmm...editing disconnected recordset,  me thinks will not work in continuous  or datasheet view of a form..
0
 

Author Comment

by:smoore6809
ID: 22780171
What do you suggest?
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 22780243
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 22780263
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now