found my problem!
I have a form that has a subform on it that contains my data I am working with. For the most part the data is based on one table (tblMissile). I am creating another table that uses the ID from tblMissile in tblMPartOnOrderSort. I added both tables to my relationships and set cascade update/delete. I have been trying to use query's, sql, and just use the delete button in access so that I may be able to delete any data that I don't need. The problem is that when I run the delete off of the form it removes the data from the form but doesn't take it from the database like I want it to. I removed the data field from tblMPartOnOrderSort and the delete works fine. I really don't know where to go with this. I am posting the following sql to show you what I am doing so that hopefully this all makes since.
Dim strSQL as String
strSQL = DELETE "tblMissile.MissileID, tblMissile.MissielTypeID, tblMissile.MLocationID, tblMissile.StatusID, tblMissile.MissileNum, tblMissile.Pri, tblMissile.EngDate, tblMissile.INEDate, tblMissile.DiscA, tblMissile.DiscB, tblMissile.DiscC, tblMissile.MNote" & _
"FROM tblMissile" & _
"WHERE tblMissile.MissileID)=forms!qryMType![qryMissileInfo Subform];"
docmd.runsql (strSQL)
the table that is linked to this is called tblMPartOnOrderSort and the only data that is in it is the MissileID and ComboPartName. I set the link to allow all data on tblMissile and only data that join fields are equal on tblMPartOnOrderSort.
Sorry to post so much but this is the last thing I need to get working to get my database to be operational.
Thanks in advance.
I changed the code to look like this:
Dim strSQL as String
strSQL = DELETE * "FROM tblMissile WHERE tblMissile.MissileID=forms!qryMType![qryMissileInfo Subform]![MissileID];"
docmd.runsql (strSQL)
I forgot to add the MissileID onto the end of the strSQL statement. It all works fine now.
I have a form that has a subform on it that contains my data I am working with. For the most part the data is based on one table (tblMissile). I am creating another table that uses the ID from tblMissile in tblMPartOnOrderSort. I added both tables to my relationships and set cascade update/delete. I have been trying to use query's, sql, and just use the delete button in access so that I may be able to delete any data that I don't need. The problem is that when I run the delete off of the form it removes the data from the form but doesn't take it from the database like I want it to. I removed the data field from tblMPartOnOrderSort and the delete works fine. I really don't know where to go with this. I am posting the following sql to show you what I am doing so that hopefully this all makes since.
Dim strSQL as String
strSQL = DELETE "tblMissile.MissileID, tblMissile.MissielTypeID, tblMissile.MLocationID, tblMissile.StatusID, tblMissile.MissileNum, tblMissile.Pri, tblMissile.EngDate, tblMissile.INEDate, tblMissile.DiscA, tblMissile.DiscB, tblMissile.DiscC, tblMissile.MNote" & _
"FROM tblMissile" & _
"WHERE tblMissile.MissileID)=forms!qryMType![qryMissileInfo Subform];"
docmd.runsql (strSQL)
the table that is linked to this is called tblMPartOnOrderSort and the only data that is in it is the MissileID and ComboPartName. I set the link to allow all data on tblMissile and only data that join fields are equal on tblMPartOnOrderSort.
Sorry to post so much but this is the last thing I need to get working to get my database to be operational.
Thanks in advance.
I changed the code to look like this:
Dim strSQL as String
strSQL = DELETE * "FROM tblMissile WHERE tblMissile.MissileID=forms!qryMType![qryMissileInfo Subform]![MissileID];"
docmd.runsql (strSQL)
I forgot to add the MissileID onto the end of the strSQL statement. It all works fine now.
Last edited: