Recordset problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
I have a form with a text box that when i click opens a popup form that
executes an on open Sql statement to populate this popup form. The statement
i'm using is a Select command. This form has a continuous subform where the
recordsource is the sql statement i'm using. All the controls as enabled and
unlocked and the form has AllowEdits=yes. The problem is that i can't write
on the controls. Is it because of the select command has recordsource?
If so, how can i filter the data to be showed on the popup form and allow me
to alter information?
 
Post the code that is running that opens this form. And the code that runs
when the form opens. And the SQL statement.
 
Luis:

If your SQL select is simple, then the form's record source isn't the
problem. But, the individual field's control source might be. If the
control source for a bound textbox contains any formula (e.g.
=DLOOKUP(.....)), then you cannot update the control. In essence, the
formulas just made it a read-only field. The SQL select statement that is
driving the form could only cause the problem if you've lost the direct
relationship between the SELECT and the underlying table and Access doesn't
know what to update.
Try replacing the SQL line with a record source of a simple, select
query and see what happens.

Steve in Ohio
 
The code that opens the popup form is:

Option Compare Database

Private Sub Referencia_DblClick(Cancel As Integer)

Forms!Encomendas.Form.Controls!Ref_esc.Value = Me.REFERENCIA.Value
DoCmd.OpenForm "Lista_REF_Armazem"

End Sub


The code that creates the recordsource of the popup form is:

Private Sub Form_Open(Cancel As Integer)
Me.RecordSource = "SELECT
ARMAZEM.ID,ARMAZEM.referencia,ARMAZEM.descricao,ARMAZEM.armazem,ARMAZEM.quant_armazem,STOCK.quantidade,QUANTIDADES_ARMAZENS.Total_Armazens
FROM (STOCK LEFT JOIN ARMAZEM ON STOCK.Referencia = ARMAZEM.Referencia) LEFT
JOIN QUANTIDADES_ARMAZENS ON ARMAZEM.Referencia =
QUANTIDADES_ARMAZENS.Referencia WHERE STOCK.referencia = '" &
Forms!Encomendas.Form.Controls!Ref_esc.Value & "' ;"

End Sub

The controls are enabled and unlocked.
 
My guess is that your query itself is not updatable. Use your SQL statement
to create a new query, and then open it in datasheet view; will it let you
add a new record? If not, it's not updatable.

My initial guess as to why is that you may not be including the primay key
field of the STOCK table in the query. If you're trying to update a table
and the query can't find the unique record in that table, that's one reason
why a query is not updatable.
 
Back
Top