473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

#deleted problem when deleting records from sql server through vba

I have a front-end access database that uses a sql server back-end to
link the tables. When I run the following code, the subform displays
#deleted in place of the deleted record. What am I doing wrong???

s = "DELETE WMS_FID FROM [tmp_PID] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
domcd.RunSQL (s)

'*** PMP 9/22/07 - Copy the records to be deleted from t_PID
to t_PID_Deleted table

s = "INSERT INTO t_PID_Deleted ( WMS_FID, S_PER_IK, S_SEQ_NB,
MRN_PRE, MRN, PID, EU, LAST_NM, FIRST_NM, MIDDLE_NM, SSN, GENDER,
MBR_TYPE, " & _
" EFF_DT, TERM_DT, CUR_STS, STATUS, [FOUND], ADDED_UN,
ADDED_DT, EDITED_UN, EDITED_DT, PREPOP, DMC_TS, TS )" & _
" SELECT t_PID.WMS_FID, t_PID.S_PER_IK,
t_PID.S_SEQ_NB, t_PID.MRN_PRE, t_PID.MRN, t_PID.PID, t_PID.EU,
t_PID.LAST_NM, t_PID.FIRST_NM, " & _
" t_PID.MIDDLE_NM, t_PID.SSN, t_PID.GENDER,
t_PID.MBR_TYPE, t_PID.EFF_DT, t_PID.TERM_DT, t_PID.CUR_STS,
t_PID.STATUS, t_PID.FOUND, " & _
" t_PID.ADDED_UN, t_PID.ADDED_DT, " & Chr(34) &
Environ("UserName") & Chr(34) & " AS Expr1, Now() AS Expr2,
t_PID.PREPOP, t_PID.DMC_TS, t_PID.TS" & _
" FROM t_PID" & _
" WHERE (((t_PID.WMS_FID)=" & Me.txt_WMS_FID & "));"

DoCmd.RunSQL (s)

'*** PMP 09/20/07 - Added to delete the dependents and
t_pids
s = "DELETE WMS_FID FROM [t_DEPENDENTS] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
DoCmd.RunSQL (s)

s = "DELETE WMS_FID FROM [t_PID] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
DoCmd.RunSQL (s)

Forms!f_pull_requests!lst_FS_Results.Form.Requery
Forms![f_pull_requests]![f_PID_Lookup_sub1].Requery

Thanks,

Paula

Oct 5 '07 #1
2 3183
Hi -

Is the sub-form that is showing the #deleted one of the ones you are
requerying? If not, it should be - that will remove the #deleted.

John
pa***@chubbyjoes.com wrote:
>I have a front-end access database that uses a sql server back-end to
link the tables. When I run the following code, the subform displays
#deleted in place of the deleted record. What am I doing wrong???

s = "DELETE WMS_FID FROM [tmp_PID] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
domcd.RunSQL (s)

'*** PMP 9/22/07 - Copy the records to be deleted from t_PID
to t_PID_Deleted table

s = "INSERT INTO t_PID_Deleted ( WMS_FID, S_PER_IK, S_SEQ_NB,
MRN_PRE, MRN, PID, EU, LAST_NM, FIRST_NM, MIDDLE_NM, SSN, GENDER,
MBR_TYPE, " & _
" EFF_DT, TERM_DT, CUR_STS, STATUS, [FOUND], ADDED_UN,
ADDED_DT, EDITED_UN, EDITED_DT, PREPOP, DMC_TS, TS )" & _
" SELECT t_PID.WMS_FID, t_PID.S_PER_IK,
t_PID.S_SEQ_NB, t_PID.MRN_PRE, t_PID.MRN, t_PID.PID, t_PID.EU,
t_PID.LAST_NM, t_PID.FIRST_NM, " & _
" t_PID.MIDDLE_NM, t_PID.SSN, t_PID.GENDER,
t_PID.MBR_TYPE, t_PID.EFF_DT, t_PID.TERM_DT, t_PID.CUR_STS,
t_PID.STATUS, t_PID.FOUND, " & _
" t_PID.ADDED_UN, t_PID.ADDED_DT, " & Chr(34) &
Environ("UserName") & Chr(34) & " AS Expr1, Now() AS Expr2,
t_PID.PREPOP, t_PID.DMC_TS, t_PID.TS" & _
" FROM t_PID" & _
" WHERE (((t_PID.WMS_FID)=" & Me.txt_WMS_FID & "));"

DoCmd.RunSQL (s)

'*** PMP 09/20/07 - Added to delete the dependents and
t_pids
s = "DELETE WMS_FID FROM [t_DEPENDENTS] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
DoCmd.RunSQL (s)

s = "DELETE WMS_FID FROM [t_PID] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
DoCmd.RunSQL (s)

Forms!f_pull_requests!lst_FS_Results.Form.Requery
Forms![f_pull_requests]![f_PID_Lookup_sub1].Requery

Thanks,

Paula
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200710/1

Oct 6 '07 #2
On Oct 5, 5:48 pm, "J_Goddard via AccessMonster.com" <u37558@uwe>
wrote:
Hi -

Is the sub-form that is showing the #deleted one of the ones you are
requerying? If not, it should be - that will remove the #deleted.

John

pa...@chubbyjoes.com wrote:
I have a front-end access database that uses a sql server back-end to
link the tables. When I run the following code, the subform displays
#deleted in place of the deleted record. What am I doing wrong???
s = "DELETE WMS_FID FROM [tmp_PID] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
domcd.RunSQL (s)
'*** PMP 9/22/07 - Copy the records to be deleted from t_PID
to t_PID_Deleted table
s = "INSERT INTO t_PID_Deleted ( WMS_FID, S_PER_IK, S_SEQ_NB,
MRN_PRE, MRN, PID, EU, LAST_NM, FIRST_NM, MIDDLE_NM, SSN, GENDER,
MBR_TYPE, " & _
" EFF_DT, TERM_DT, CUR_STS, STATUS, [FOUND], ADDED_UN,
ADDED_DT, EDITED_UN, EDITED_DT, PREPOP, DMC_TS, TS )" & _
" SELECT t_PID.WMS_FID, t_PID.S_PER_IK,
t_PID.S_SEQ_NB, t_PID.MRN_PRE, t_PID.MRN, t_PID.PID, t_PID.EU,
t_PID.LAST_NM, t_PID.FIRST_NM, " & _
" t_PID.MIDDLE_NM, t_PID.SSN, t_PID.GENDER,
t_PID.MBR_TYPE, t_PID.EFF_DT, t_PID.TERM_DT, t_PID.CUR_STS,
t_PID.STATUS, t_PID.FOUND, " & _
" t_PID.ADDED_UN, t_PID.ADDED_DT, " & Chr(34) &
Environ("UserName") & Chr(34) & " AS Expr1, Now() AS Expr2,
t_PID.PREPOP, t_PID.DMC_TS, t_PID.TS" & _
" FROM t_PID" & _
" WHERE (((t_PID.WMS_FID)=" & Me.txt_WMS_FID & "));"
DoCmd.RunSQL (s)
'*** PMP 09/20/07 - Added to delete the dependents and
t_pids
s = "DELETE WMS_FID FROM [t_DEPENDENTS] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
DoCmd.RunSQL (s)
s = "DELETE WMS_FID FROM [t_PID] WHERE [WMS_FID]=" &
Me.txt_WMS_FID
DoCmd.RunSQL (s)
Forms!f_pull_requests!lst_FS_Results.Form.Requery
Forms![f_pull_requests]![f_PID_Lookup_sub1].Requery
Thanks,
Paula

--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...- Hide quoted text -

- Show quoted text -
Yes, the subform that shows the #deleted is the subform I am
requerying.

Oct 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Robert Brown | last post by:
Our customer (of our ecommerce system) wants to be able to preserve deleted entities in the database so that they can do reporting, auditing etc. The system is quite complex where each end user...
3
by: Chumley the Walrus | last post by:
IN my code behind .vb page for a delete records script (this also does a deletion confirmation with a javascript popup, this gets called on my front .aspx page with the datagrid), I'm not sure if...
10
by: DaveDiego | last post by:
I've had a user delete one of the client records, I do have a version of the DB with all records intact before the deletion occured. Whats the best approach to getting all the related records in...
2
by: maddman | last post by:
I have an odd problem with my database, and was hoping someone could point me at the problem. We have an access database that is used by several people to input data. Users have reported some...
1
by: iam247 | last post by:
Hi I am a relative beginner with SQL and ASP. With some help after previous posts I have a page which successfully requests querystrings from another page and deletes a record from an access...
8
by: ibiza | last post by:
Hi SQL fans, I realized that I often encounter the same situation in a relation database context, where I really don't know what to do. Here is an example, where I have 2 tables as follow: ...
3
by: BrianDP | last post by:
I have a database with a split front end/back end. There is a key table in the back end called Catalog, and it is sort of a central key table for all sorts of things. It's a list of all the jobs...
4
by: Joris De Groote | last post by:
Hi, (my code is @ the bottom of this message) I have a piece of code that runs the rows of a dataset until it finds the one needed. When he finds it, I delete that row and start all over...
1
by: perryche | last post by:
I do not know what happened, but all of a sudden, a particular row of records had changed to "#Deleted" to all of them. What might be the cause, and how to prevent this? This is not the first...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.