473,386 Members | 1,654 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,386 software developers and data experts.

Need Help in delete command event

I am really new to visual basic programming language. I want to design a form with a list box and delete button. when i select a particular month and press delete it will delete with the query. the code dont work. hope u guys can help pls. thx in advance


Private Sub Command4_Click()

ListBox ListBox1

Month1 = ListBox1.Value

Dim SQL As String

SQL = "DELETE FROM Table2 where Datetime = Month1 "


MsgBox "Deleted !"



End Sub
Sep 8 '07 #1
4 1165
FishVal
2,653 Expert 2GB
I am really new to visual basic programming language. I want to design a form with a list box and delete button. when i select a particular month and press delete it will delete with the query. the code dont work. hope u guys can help pls. thx in advance


Private Sub Command4_Click()

ListBox ListBox1

Month1 = ListBox1.Value

Dim SQL As String

SQL = "DELETE FROM Table2 where Datetime = Month1 "


MsgBox "Deleted !"



End Sub
Hi, there.

Take a look at "Month" VBA function.
Sep 8 '07 #2
hihi thx....
But wher do i look at "Month" VBA function.?
Sep 8 '07 #3
Hey i saw the month function , but the current problem is i do not know how do the delete query. Is the any required connection to the database from the vba codes. when i view the form and click the button, it does not execute the query.
Sep 8 '07 #4
FishVal
2,653 Expert 2GB
Hey i saw the month function , but the current problem is i do not know how do the delete query. Is the any required connection to the database from the vba codes. when i view the form and click the button, it does not execute the query.
:)

And now take a look at DoCmd.RunSQL.

Regards,
Fish
Sep 9 '07 #5

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

Similar topics

4
by: Stephen | last post by:
I have got an event below to remove items from an arraylist and then to rebind the arraylist to the datagrid subsequently deleting the appropriate row. My problem is that my code makes sense and I...
2
by: Jim McGivney | last post by:
I am using a Microsoft Book as a guide and trying to construct a Delete Command Event Handler for a DataGrid. The book lists the statement: ...
7
by: Rémi | last post by:
Hello. I have just gotten a client-side delete confirmation Javascript button to work, using this FAQ question as a basis (3rd question down, URL...
1
by: Steve | last post by:
Is it possible to have a confirmation dialogue appear when the delete command is clicked on a gridview? i.e. asking the "Are you sure you wish to delete this record?" question. I just don't like...
5
by: Neil | last post by:
I am getting time-out errors when I try to perform a simple delete on a linked server. The command is: Delete From MyTable Where PKID=12345 I have tried executing this command directly from...
3
by: tarscher | last post by:
Hi all, I have a grid that contains 7 columns from 3 tables (3 unique keys, 4 normal fields). I show this 7 columns on the gridview. I now want to add edit and delete functionality. This should...
46
by: Bruce W. Darby | last post by:
This will be my very first VB.Net application and it's pretty simple. But I've got a snag in my syntax somewhere. Was hoping that someone could point me in the right direction. The history: My...
4
by: mforema | last post by:
Hey Everybody, I have a form with a label ("Enter Password"), a textbox (with a password InputMask), and two command buttons ("OK" and "Cancel"). I've successfully written code for the "OK" command...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a...
0
by: pavankumar106 | last post by:
Hi im stuck in sm simple pb ..im having a datalist in wich im having images and each image have a delete button below it.now wen I press delete button I shud be able to delete that image in dataset...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.