hi mmcdonal,
Thanks for your reply. i dont know much about VBA as i m new to access.
i wrote the codes as below, with those codes i am just able to do inserting for the main form (table:Master)only.
Now i dont know how to add the data in the subform into [Details] table as it reply cant find the field.
What should i write for the SQL statements so that when the ADD button is pressed both the main form and the subform save under the same record? the subform contains unbound textboxes ..
Dim strSQL As String
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
strSQL = "Select * from Master Where "
strSQL = strSQL & "[DocNo] = '" & Me.textDocNo & "'"
Set rs = db.OpenRecordset(strSQL, DB_OPEN_DYNASET)
If rs.EOF Then
strSQL = "INSERT INTO Master (DocNo,SName)" & _
"VALUES('" & Me.textDocNo & "', '" & Me.textSenderName & "');"
DoCmd.RunSQL strSQL
rs.Close
db.Close
Thanks a lot...
|