473,503 Members | 4,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

To delete or add a record

106 New Member
Hi Guys

I have form which displays information for 4 different tables, It is actually based on a query.

I have Tab Control in my form, for each Item in the form I have 2 tabs.
Tab1 shows detail-1, tab2 shows detail2.
I want to be able to delete detail-1 or detail-2 for each item, or add a new detail.

Can any one help?????

THanks
Dec 11 '06 #1
8 1507
NeoPa
32,557 Recognized Expert Moderator MVP
I have Tab Control in my form, for each Item in the form I have 2 tabs.
Tab1 shows detail-1, tab2 shows detail2.
I have no idea what you're referring to here.
What does 'each item' mean?

Can you make your question clearer so that someone can give you an answer.
Dec 11 '06 #2
tara99
106 New Member
I have no idea what you're referring to here.
What does 'each item' mean?

Can you make your question clearer so that someone can give you an answer.
By item i meant application.
For each application I have 2 TabControl (2 windows) called Server and Contacts.
In Tab Server I have displayed Server (where application is located), Server Description and the location of server.

In tab Contacts, I have displayed information like department and contact details for that application, (information of the person to contact to when an application is broken or needs to be updated)

Now the location of the application (the server it was located in) has changed and also the department and the contact details has changed too therefore I need to delete them of the table and insert a new information instead.
I have 2 buttons "Delete" and "Add New" in each of the window (Tab) which should perform delete and insert operation on the tables.

I need help performing these operations.
I hope this is clear enough.

Thanks
Dec 12 '06 #3
tara99
106 New Member
By item i meant application.
For each application I have 2 TabControl (2 windows) called Server and Contacts.
In Tab Server I have displayed Server (where application is located), Server Description and the location of server.

In tab Contacts, I have displayed information like department and contact details for that application, (information of the person to contact to when an application is broken or needs to be updated)

Now the location of the application (the server it was located in) has changed and also the department and the contact details has changed too therefore I need to delete them of the table and insert a new information instead.
I have 2 buttons "Delete" and "Add New" in each of the window (Tab) which should perform delete and insert operation on the tables.

I need help performing these operations.
I hope this is clear enough.

Thanks
I have send this email a while ago and still didn't have any response.

I just want to know how to Insert or delete from a table using SQL statment in VBA.
Dec 13 '06 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
I have send this email a while ago and still didn't have any response.

I just want to know how to Insert or delete from a table using SQL statment in VBA.
OK Tara

Basic syntax ...


Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3.    ' To delete a record
  4.    strSQL = "DELETE * FROM TableName WHERE [ID Field]=" & Me.[ID Field]
  5.    DoCmd.RunSQL strSQL
  6.  
  7.    ' To insert a record
  8.    strSQL = "INSERT INTO TableName (Field1, Field2, Field3) " & _
  9.         "VALUES (" & Me.textbox1 & ", " & Me.textbox2 & ", " & Me.textbox3 & ");"
  10.  

Mary
Dec 13 '06 #5
NeoPa
32,557 Recognized Expert Moderator MVP
I have send this email a while ago and still didn't have any response.

I just want to know how to Insert or delete from a table using SQL statment in VBA.
Tara,

Two things :
1. Please don't complain about any delays in responding to posts. We have a bunch of experts on here who choose to spend their time helping you and others like you in their free time. It is entirely inappropriate for you or anyone else to complain that they are not quick enough or even, if I'm to be honest, that they may choose not to respond to any individual request at all. As helpers I am happy for any of them to make that choice. They very rarely do thank goodness (if you look at some of the post times you'll see that great efforts are made already just to keep up with as much as possible).
(Moderator hat on).

2. If you tell me which version of Access you are running I will tell you how to find some very interesting information on SQL commands that are usually difficult to find when going the normal ways through help. I've had to do it for '97 through 2K3 and managed to get there on all so far, but sometimes after a lot of very counter-intuitive searching.
Dec 14 '06 #6
tara99
106 New Member
Tara,

Two things :
1. Please don't complain about any delays in responding to posts. We have a bunch of experts on here who choose to spend their time helping you and others like you in their free time. It is entirely inappropriate for you or anyone else to complain that they are not quick enough or even, if I'm to be honest, that they may choose not to respond to any individual request at all. As helpers I am happy for any of them to make that choice. They very rarely do thank goodness (if you look at some of the post times you'll see that great efforts are made already just to keep up with as much as possible).
(Moderator hat on).

2. If you tell me which version of Access you are running I will tell you how to find some very interesting information on SQL commands that are usually difficult to find when going the normal ways through help. I've had to do it for '97 through 2K3 and managed to get there on all so far, but sometimes after a lot of very counter-intuitive searching.
Hi NeoPa
Thanks for raising this point and please don’t get me wrong, I am not complaining at all. I am thankful and I really do appreciate the efforts that all the experts make to answer our question.
I am aware that there may me delays or the expert may not even want to answer any question, I understand that completely.

There are many new developers like me who want their questions answered, and because of that the thread may be forgotten.
So instead of creating a new thread for the same question I have just replied to my self to bring it on the top of the list and get attract the experts attention and that was all.

I am running 2002 version of Access at work, and 2003 at home.

Thanks
Dec 14 '06 #7
tara99
106 New Member
OK Tara

Basic syntax ...


Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3.    ' To delete a record
  4.    strSQL = "DELETE * FROM TableName WHERE [ID Field]=" & Me.[ID Field]
  5.    DoCmd.RunSQL strSQL
  6.  
  7.    ' To insert a record
  8.    strSQL = "INSERT INTO TableName (Field1, Field2, Field3) " & _
  9.         "VALUES (" & Me.textbox1 & ", " & Me.textbox2 & ", " & Me.textbox3 & ");"
  10.  

Mary

Thank you Mary
That is all I needed.
Dec 14 '06 #8
NeoPa
32,557 Recognized Expert Moderator MVP
Tara,

Thank you for your reply - very clearly and nicely put.
I have to look out for such things as a moderator as we feel it's important to protect all our experts and make them know we value them all highly :).
I'm not trying to sound grumpy - honest.

In future, just post something like 'Bumping Thread' - that's what we all do when we feel the need (not too many times though).

-Adrian.
Dec 14 '06 #9

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

Similar topics

1
4438
by: Someonekicked | last post by:
I have a binary file, and I need to delete a specific number of characters in it. The file contains records, each record has a specific length. So the way I wanna handle deleting is that I will...
9
10604
by: Robert Schneider | last post by:
Hi to all, I don't understand that: I try to delete a record via JDBC. But I always get the error SQL7008 with the error code 3. It seems that this has something to do with journaling, since the...
8
4033
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
3
3955
by: Uwe Range | last post by:
Hi to all, I am displaying a list of records in a subform which is embedded in a popup main form (in order to ensure that users close the form when leaving it). It seems to be impossible to...
3
7803
by: Maria | last post by:
Is there another way to delete the current record in a subform from the main form, another subform or a sub-subform other than setting focus on a field in the subform and using run command...
4
7833
by: Susan Bricker | last post by:
I have a command button on a form that is supposed to Delete the record being displayed. The record is displayed one to a form. The form is not a Pop-Up nor is it Modal. Tracing the btnDelete...
5
4131
by: Bob Bridges | last post by:
Start with two tables, parent records in one and child records in the other, a one-to-many relationship. Create a select statement joining the two. Display the query in datasheet mode. When I...
4
2542
by: Craggy | last post by:
Hi, I am trying to pop up a yes/no message box so that a user can delete a record in a continuous form. The default delete message is a bit sloppy because it seems to move the continuous form to...
5
3902
by: sh26 | last post by:
I can Add and Delete (A, CName, MX and TXT) Dns records on the Dns Server using C# code. The problem I am having is if someone manaully creates a TXT record on the Dns Server, I cannot delete that...
10
7141
beacon
by: beacon | last post by:
Hi everybody, This is probably going to sound unorthodox, but I have to log records that are deleted...I know, go figure. Anyway, I have a form with a (continuous) subform, and on the subform I...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4992
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.