By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,400 Members | 1,021 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,400 IT Pros & Developers. It's quick & easy.

To delete or add a record

100+
P: 106
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
Share this Question
Share on Google+
8 Replies


NeoPa
Expert Mod 15k+
P: 31,661
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

100+
P: 106
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

100+
P: 106
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
Expert Mod 10K+
P: 14,534
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
Expert Mod 15k+
P: 31,661
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

100+
P: 106
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

100+
P: 106
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
Expert Mod 15k+
P: 31,661
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

Post your reply

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