Hello Access gurus.
I read an article of Banana regarding RecordSource and its Updatability.
QUESTIONs:
Is it possible for DAO to do the same?
Can DAO return a Recordset that is updatable? If so, how?
Please take time to check the code I made:
(so far)
My system CAN DO the ff:
[1] Execute SELECT Query
[2] Execute INSERT Query
[3] Execute UPDATE Query
[4] Execute DELETE Query
[5] Display data in a Datasheet SubForm
My system CANNOT DO the ff:
[1] Edit the data displayed in a Datasheet SubForm
It would be great if you guys could give time on this issue.
I read an article of Banana regarding RecordSource and its Updatability.
Bound forms' recordsource and updateability
One distinct advantage ADO have over DAO, including ODBCDirect, is it enables us to pass a SQL string in the backend's native dialect and return a recordset that is fully updateable and thus can be bound forms, under certain constraints.
Source: http://www.access-programmers.co.uk/forums/showthread.php?t=172243
QUESTIONs:
Is it possible for DAO to do the same?
Can DAO return a Recordset that is updatable? If so, how?
Please take time to check the code I made:
Code:
Private Sub Form_Load_ForPosting()
Dim ws As Workspace
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sSQL As String
sSQL = "SELECT Table1.Column11, Table1.Column12, Table2.Column21, Table2.Column22 "
sSQL = sSQL & "FROM Table1 INNER JOIN Table2 ON Table1.Column11 = Table2.Colx;"
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("MyAccessDB.mdb", , , "ODBC;DSN=DB_NAME;UID=;PWD=")
Set rs = db.OpenRecordset(sSQL)
'Set the form's Recordset property to the DAO recordset
Set Me.Form.Recordset = rs
Me.Form.AllowEdits = True
'Dynaset = 0
'Dynaset (Inconsistent Updates) = 1
'Snapshot = 2
Me.Form.RecordsetType = 1
Me.Form.[Column12].Enabled = True
Me.Form.[Column12].Locked = False
'Data of Column12 can be displayed but cannot be edited :(
'If db is using "(CurrentDb)", Column12 can (both) be displayed and edited
'What did I miss?
'If the SQL query cannot update the data, how can I make it possible to update the data?
End Sub
(so far)
My system CAN DO the ff:
[1] Execute SELECT Query
[2] Execute INSERT Query
[3] Execute UPDATE Query
[4] Execute DELETE Query
[5] Display data in a Datasheet SubForm
My system CANNOT DO the ff:
[1] Edit the data displayed in a Datasheet SubForm
It would be great if you guys could give time on this issue.