Subform Deleting Problem

S

scott

I've got a continuos sub form with a recordsource that's listed below. The
subform dispays accounts and their passwords, etc. My problem is because I'm
using a sql join statement, I can't delete any subform records from the
subform. Normally, I would not use a join statement in a subform, but I was
forced to do it in order to sort by the user's First and Last name that
resides in a related users table (The accounts table has a userID field that
links to users table).

Given that situation, is there any way to delete records from a continuos
subform if the subform has a recordsource that uses a join like my below
sql?



RECORDSOURCE:

SELECT a.accID, a.userID, a.accUser, a.accPwd, a.accEmail, u.userLast,
u.userFirst

FROM accounts AS a INNER JOIN

users u ON a.userID = u.userID

ORDER BY u.userFirst, u.userLast
 
G

Guest

Which table to you want to delete them from (accounts, or users)?

IF you put a command button (cmd_Delete) in the footer of the continuous
form, you could have code in it that deletes a record from either of the
tables. Something like:

Private sub cmd_Delete_Click

Dim strSQL as string

strSQL = "DELETE * FROM tbl_Accounts " _
& "WHERE Account_ID = " & me.txt_Account_ID
currentdb.execute strsql

me.requery

End Sub

HTH
Dale
 
S

scott

I figured it out. Thanks
Dale Fye said:
Which table to you want to delete them from (accounts, or users)?

IF you put a command button (cmd_Delete) in the footer of the continuous
form, you could have code in it that deletes a record from either of the
tables. Something like:

Private sub cmd_Delete_Click

Dim strSQL as string

strSQL = "DELETE * FROM tbl_Accounts " _
& "WHERE Account_ID = " & me.txt_Account_ID
currentdb.execute strsql

me.requery

End Sub

HTH
Dale
 

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