Solved

Form is read only even though query behind it is editable

Posted on 2008-10-22
17
297 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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
 

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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 22780243
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22780263
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

828 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