Basing a form on SQL as opposed to a table or query “forms.RecordSource = “SELECT XXX”

C

CES

All,

When you base a Form on SQL as opposed to using a table or query is the recordset read-only? I've tried using:

forms.myForm.RecordSource = "some SQL"

But it seems that the record set that is returned is indeed read-only. I was wondering if that is in fact the only behavior or is there some switch that I need to use in order make the recordset editable.

Is this considered to be a "SQL pass-through query"?

Thanks in advance. - CES
 
R

Rick Brandt

CES said:
All,

When you base a Form on SQL as opposed to using a table or query is
the recordset read-only? I've tried using:

Depends on the SQL.
forms.myForm.RecordSource = "some SQL"

But it seems that the record set that is returned is indeed
read-only. I was wondering if that is in fact the only behavior or is
there some switch that I need to use in order make the recordset
editable.
Is this considered to be a "SQL pass-through query"?

No. Different animal.
Thanks in advance. - CES

Any query whether it is a saved query object in the db window or a SQL
Statement *might* produce a read-only result set. In fact more of them are
read only than are not. Post the SQL you are using and we might be able to
see why it is read only.

Otherwise see the help topic "When can I update data in a query?"
 
M

Mr B

CES,

If the SQL statement that you are passing to the forms record source is not
updatable then the data in your form will also not be updatable. If the sql
statement you use as the record source is updatable the you will be able to
update the data in your form.

This is not the same as a Pass through query. Per the Access help file:

A pass-through query sends commands directly to ODBC databases, such as
Microsoft FoxPro, using commands that are accepted by the server. For
example, you can use a pass-through query to retrieve records or change data.
With pass-through queries, you work directly with the tables on the server
instead of linking to them. Pass-through queries are also useful for running
stored procedures on an ODBC server.

To test the update capabilities of your sql statement, try creating your sql
statement as a query, using the QBE. Run the query and then try updating or
change the values while in the query results. If you can update the data
there then you would be able to update the records in your form.

--
HTH

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 
C

CES

Mr said:
CES,

If the SQL statement that you are passing to the forms record source is not
updatable then the data in your form will also not be updatable. If the sql
statement you use as the record source is updatable the you will be able to
update the data in your form.

This is not the same as a Pass through query. Per the Access help file:

A pass-through query sends commands directly to ODBC databases, such as
Microsoft FoxPro, using commands that are accepted by the server. For
example, you can use a pass-through query to retrieve records or change data.
With pass-through queries, you work directly with the tables on the server
instead of linking to them. Pass-through queries are also useful for running
stored procedures on an ODBC server.

To test the update capabilities of your sql statement, try creating your sql
statement as a query, using the QBE. Run the query and then try updating or
change the values while in the query results. If you can update the data
there then you would be able to update the records in your form.
All,
I'm sorry for wasting your time, I had a required field in the table that was causing the problem... Thank You
 
Top