Reputation: 1571
I spend half day to figure out how to access value in nested datasheet form record. Please, take a look at image below. I have dblClick event on "SID" column cell. It's field name is "txtSID". I need to grab that value (in picture "20") and pass it in VBA SQL. There is some trick with datasheets. Looks like they has no control name or something.
Upvotes: 0
Views: 962
Reputation: 1571
Looks like I found solution. """ & Me![txtSID] & """ does the thing.
Private Sub txtSID_DblClick(Cancel As Integer)
Dim SQL As String
SQL = "INSERT INTO documents (stakeholder_id, document_type_id, status_id) VALUES (""" & Me![txtSID] & """, 1, 1);"
DoCmd.SetWarnings False
DoCmd.RunSQL SQL
DoCmd.SetWarnings True
End Sub
Upvotes: 0