473,324 Members | 2,214 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,324 software developers and data experts.

Append/Delete

Hi All, have just found and joined this forum. Bit of background - am 74yrs using m/s office pro 2003 self taught. Using access for small club database. I have a command button on a switchboard that I want to append members details to another database and then delete the record from the current database (member leaves club or is deceased). Am using a combo box to select the record to append/delete but am having a problem with vba code. Briefly -
Expand|Select|Wrap|Line Numbers
  1.  DoCmd.SetWarnings True
  2.  
  3.        DoCmd.RunSQL "INSERT INTO LDMRC_Deleted_Members (Name_Prefix,First_Name,Last_Name,Address_1,Address_2,Address_3,Town,Post_Code,Tel_No,Mobile_No,E_Mail,Notes) Values ('" & Me.Combo4.Column(1) & "','" & Me.Combo4.Column(2) & "','" & Me.Combo4.Column(3) & "','" & Me.Combo4.Column(4) & "','" & Me.Combo4.Column(5) & "','" & Me.Combo4.Column(6) & "','" & Me.Combo4.Column(7) & "','" & Me.Combo4.Column(8) & "','" & Me.Combo4.Column(9) & "','" & Me.Combo4.Column(10) & "','" & Me.Combo4.Column(11) & "','" & Me.Combo4.Column(12) & "')"
  4.  
  5. DoCmd.RepaintObject
  6.  
  7. DoCmd.RunSQL "DELETE FROM LDMRC_Table1 WHERE Membership_No = ('" & Me.Combo4.Column(1) & "')"
  8.  
  9. End Sub  
The append bit works ok but can not get delete part to work.

Would appreciate any help
Dec 13 '13 #1
2 1138
Luuk
1,047 Expert 1GB
you do not need the '()' in:
Expand|Select|Wrap|Line Numbers
  1.  DoCmd.RunSQL "DELETE FROM LDMRC_Table1 WHERE Membership_No = ('" & Me.Combo4.Column(1) & "')"
change to:
Expand|Select|Wrap|Line Numbers
  1.  DoCmd.RunSQL "DELETE FROM LDMRC_Table1 WHERE Membership_No = '" & Me.Combo4.Column(1) & "'"
The single quotes around Me.Combo4.Column(1) are only needed if it's an alpha field.
If it's numeric, than they are not needed too.
Dec 13 '13 #2
Thanks Luuk for your reply. Have not altered my code yet as per your reply, having been away for Christmas/New year. Hoping to do that shortly and will advise if works OK.

Delboy39
Jan 3 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Smith | last post by:
Hello all, I don't know c# that well and thus need urget help. I have a page that displays files from an access database that has a button to be delet file from database. I need a confirmation...
1
by: Greg | last post by:
I run some reports from the web that is connected to an Access database. I run a macro every 25 minutes that deletes the tables and then appends data to the tables with fresh data. The issue I have...
9
by: JMCN | last post by:
hi- i have inherited an access 97 database that keeps track of the loans. i have been running into referential intergrity problems when i try to append new loans to table. first of all is a...
4
by: MN | last post by:
I have to import a tab-delimited text file daily into Access through a macro. All of the data needs to be added to an existing table. Some of the data already exists but may be updated by the...
1
by: kamle_b | last post by:
I know it is best said to archive records when you press delete button. I need help with this. I have a list box where filtered data is showed. The user highlights the record and clicks on delete...
0
by: Ira Solomon | last post by:
Many years ago (1999) I created a front end that allowed allowed end users to write their own select queries and reports, but did not allow queries that changed any data. I want to do it again,...
10
by: pythonnoob | last post by:
Hello everyone. New to python as well as this forum, but i must say ive learned a but already reading through some posts. Seems to be a pretty helpful community here. Before i post a question...
3
by: rudeman76 | last post by:
Hello, I have 2 DB that are linked (they are pretty much identical). I have an append sql statement. It works fine for most of it. I just have two questions. 1. When I started the DB I was...
4
by: Scott12345 | last post by:
Hi, here is my situation, I have a DB that tracks machine downtime (30 machines) per day. Several users will update this through the day. I created an append query that creates 30 dummy values and...
8
jinalpatel
by: jinalpatel | last post by:
I have two tables. tblClass and tblWithdrawn. On my main form(bound to tblClass) I have several data entry fields like Date withdrawn, Status (active or withdrawn) Date Classified etc. Also...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.