SQL Update with Subforms

G

Guest

I have a main form "FrmA" and a subform "DESC". I'm trying to update a table
Anesth with fields from both th form and subform. I swear this was working,
but now I'm no longer getting the subform data. I'm certain there's
something wrong with this format: Forms!FrmA.DESC![line] Any ideas?


Heres a sample:

Dim strSQL As String
strSQL = "UPDATE Anesth SET [ip_date] = Trim$([date]), " & _
"[ip_lastname] = Trim$([lastname]), " & _
"[ip_firstname] = Trim$([firstname]), " & _
"[ip_desc] = Forms!FrmA.DESC![line] " & _
"WHERE Anesth.[fldacct] = [pat-acct];"
DoCmd.RunSQL strSQL
 
G

Guest

Forms!FrmA.DESC.Form![line]
or
Me.DESC.Form.[Line]

These assume that the name of your subform control is DESC.
Barry
 
G

Guest

That worked....many thanks!!!!

Barry Gilbert said:
Forms!FrmA.DESC.Form![line]
or
Me.DESC.Form.[Line]

These assume that the name of your subform control is DESC.
Barry

Sash said:
I have a main form "FrmA" and a subform "DESC". I'm trying to update a table
Anesth with fields from both th form and subform. I swear this was working,
but now I'm no longer getting the subform data. I'm certain there's
something wrong with this format: Forms!FrmA.DESC![line] Any ideas?


Heres a sample:

Dim strSQL As String
strSQL = "UPDATE Anesth SET [ip_date] = Trim$([date]), " & _
"[ip_lastname] = Trim$([lastname]), " & _
"[ip_firstname] = Trim$([firstname]), " & _
"[ip_desc] = Forms!FrmA.DESC![line] " & _
"WHERE Anesth.[fldacct] = [pat-acct];"
DoCmd.RunSQL strSQL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top