VB.NET Tutorial - Delete Records From a Microsoft Access Database

  Рет қаралды 19,469

VB Toolbox

VB Toolbox

Күн бұрын

This is Part 3 in my VB.NET series on working with a Microsoft Access Database. In this tutorial I will be demonstrating how to Select and Delete records in your MS Access Database using a DataGridView as well as a ComboBox control.
Project Source Code: www.dropbox.co...
Thank you for supporting this channel!

Пікірлер: 37
@nestorcosio7088
@nestorcosio7088 8 жыл бұрын
Excellent tutorial ! appreciating their efforts in the tutorials greetings from Tijuana
@starflight6836
@starflight6836 4 жыл бұрын
Bro, you are an absolute god Thank you
@josemunozvargas
@josemunozvargas 3 жыл бұрын
Thank you very much for your videos. It is very difficult to find VB.Net videos.
@jerbyapa9229
@jerbyapa9229 4 жыл бұрын
i just watch this from beginning tell end with thumbs up
@shamanu67
@shamanu67 8 жыл бұрын
you are a very good trainer, thank you! I have only one little worry about (Focus) :) when you start, Delete User Menu is active, and will remove the first positions...
@ahmedsafiy3557
@ahmedsafiy3557 4 жыл бұрын
thank u
@bolingchen6240
@bolingchen6240 8 жыл бұрын
great video.thank you for share this .
@Funtastic91
@Funtastic91 8 жыл бұрын
YOU DA MAN !
@yba3798
@yba3798 8 жыл бұрын
thank you again!
@bodylojohn
@bodylojohn 8 жыл бұрын
Another great tutorial. Keep em comming. Do you also have a tutorial about saving data directly to a db from the datagridview? Thanks in advance!!
@VBToolbox
@VBToolbox 8 жыл бұрын
+Johnny Hermes (Bodylojohn) Thank you! I have done this, but haven't yet created a tutorial for it in MS Access due to the complexities of creating the UpdateCommand with OleDB. It was a bit frustrating getting it to work properly because it requires strong enforcement of data types. :-/
@pw3111
@pw3111 5 жыл бұрын
Excellent Series.Thanks. I've just finished the third in the series - deleting a record and while all the controls seem to work, the row I delete is still on the screen. The properties for the data base are still set to "copy if newer" as set in the first video. I've changed to "always copy" and its still the same problem. I've notice a few differences between your screen and mine that were on your screen in the 2nd in the series but not in the third series eg, Form1_load is in the 2nd series but not in the third. Any help would be appreciated.
@ChristianHaugland74
@ChristianHaugland74 8 жыл бұрын
I made the NoError Function A little better and have it in a Module :) Also Made Two Error Function to ease the use of error msgboxes. Make a new module and copy this code into the new module, and now you can use it in your whole application. Parameters in NoErrors Function Text: The text to be checked Report: Show Error Message? True/False CheckFor: uses enum NoErrorStates and if Empty is selected then function use IsNullOrEmpty function, If Whitespace is selected then IsNullOrWhitespace function is used. Empty = 0 WhiteSpace = 1 if integers is used. Here is my code i use: '------------------------------------------------------- CODE BELOW ---------------------------------------------------- Public Enum NoErrorStates Empty = 0 WhiteSpace = 1 End Enum Public Function NoErrors(Text As String, Optional Report As Boolean = False, _ Optional CheckFor As NoErrorStates = NoErrorStates.Empty) As Boolean Select Case CheckFor Case NoErrorStates.Empty If Not String.IsNullOrEmpty(Text) Then If Report = True Then ShowDBError(Text) ' Report Errors Return False End If Case NoErrorStates.WhiteSpace If Not String.IsNullOrWhiteSpace(Text) Then If Report = True Then ShowDBError(Text) ' Report Errors Return False End If Case Else ShowError("Unknown NoErrorStates") Return False End Select Return True End Function Public Sub ShowDBError(text As String) MsgBox(text, MsgBoxStyle.Critical, "Database Error.") End Sub Public Sub ShowError(text As String) MsgBox(text, MsgBoxStyle.Critical, "Error.") End Sub
@amberm2035
@amberm2035 6 жыл бұрын
Thank you thank you ! :D
@robertbhandari7829
@robertbhandari7829 7 жыл бұрын
Thank you sir.
@camerensmith9729
@camerensmith9729 2 жыл бұрын
I am having an issue @ 31:04 where it is giving me the error Option Strict On disallows implicit conversions from 'Object" to 'String'. I believe this issue is the reason I am only able to delete through the combo box. Visual Studio recommends trying an explicit cast where I would SelectUser(CStr(dvgData.Item(1, e. RowIndex)).Value which does get rid of the error, but I still have a logical error where I can only select a record with the combo box.
@chuckswan5657
@chuckswan5657 4 жыл бұрын
Thank you so much for these very useful tutorials. How can I get copies of the code you create? While your instructions are quite clear, I could really use the code to refresh my knowledge when I'm trying this stuff myself.
@marcush5475
@marcush5475 8 жыл бұрын
Hello, Thanks for sharing this. Helps me out so much. I would like some more help, if I want to show the user the ID in a messagebox when they save a new user, how would I do that?
@pw3111
@pw3111 8 ай бұрын
I've got a problem with the delete by dgvData_CellClick method. If I click off the actual values I get the following error message System.InvalidCastException: 'Conversion from type 'DBNull' to type 'String' is not valid.' I was under the impression that your " ' PREVENT OUT OF INDEX RANGE ERRORS If e.RowIndex < 0 Or e.ColumnIndex < 0 Then Exit Sub" would handle it but it doesn't seem to be. Any suggestions?
@VBToolbox
@VBToolbox 8 ай бұрын
Hi, @pw3111! The index out of range prevention is only to handle errors when clicking to the far top or left where a negative index value was produced. The casting error you're seeing seems more related to the actual data in your dgv or database where it's trying to translate or do something with a NULL record from your table. Are you using this for another project or just copying the tutorial? It's a little tricky to troubleshoot without seeing the code and data and I'm a little rusty, but if it's a small project you could share, I can see if I can figure out the issue.
@pw3111
@pw3111 8 ай бұрын
@@VBToolbox on my access data base, there is a blank row at the bottom with a * on the far left. This is where a new entry will go and is present on all Access databases I build. It’s when I Click into this row that the error occurs. On your “delete “ example program, there is no blank line at the bottom of your database so there is nothing to click into to cause the error. How did you accomplish this as all my databases have this empty bottom row? I can hide this bottom row by choosing “Addaddition=false” in the database properties but then I can’t enter a new record. Thanks for any help.
@pw3111
@pw3111 8 ай бұрын
Problem solved!, On datagridview for my delete forms, I clicked on the top right hand corner of the datagridview and unchecked the “enable adding” option. I left it checked on the any forms where I wanted to add data. Once again your videos have been very educational and your replies have been very helpful as well as they point me in the right direction and make me think. Thanks.
@VBToolbox
@VBToolbox 8 ай бұрын
@@pw3111 Hello! Sorry I wasn't able to get back earlier. That is great news that you were able to resolve the issue! Thank you for sharing the resolution. It may be helpful in the event that someone else encounters something similar. :-)
@ZintomV1
@ZintomV1 9 жыл бұрын
Hey nice video, I was wondering when your going to start up your other channel again, thanks, Tom.
@rysun87
@rysun87 7 жыл бұрын
why does "ByVal" appears in every sub i created? For Example: Private Sub cmdFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFind.Click SearchMembers(txtFind.Text) End Sub Please Help...
@laptopDoctorKZN
@laptopDoctorKZN 4 жыл бұрын
hi where is the video for adding users??
@pw3111
@pw3111 5 жыл бұрын
Problem fixed !!
@ksmemon1
@ksmemon1 6 жыл бұрын
Hi, How Can I Deal When I Have Created Function to Get Level And I am Using this Function During Save Data Sub for Example In Save Sub I Have Created Access. AddParam("@Level",GetLevel (Id)) And GetLevel Has Access. ExecQuery ("Select from Level From Accounts Where ID =1)
@rowanbalana8578
@rowanbalana8578 7 жыл бұрын
I have a question please answer.. Everything is working especially when i start the program and click anywhere then it will show on the label but once i click the find button and then return to normal and click anything it won't show on the label anymore
@VBToolbox
@VBToolbox 7 жыл бұрын
Hello, Kris. :-) I'm a little confused. Which part of the video are you referring to?
@rashidfaheem9838
@rashidfaheem9838 6 жыл бұрын
You deleted record whose id was 7 but all the other ids were same after deleting. Is it possible to delete any record and update all ids after that? like we delete record number 7 aur record number 8 should be at place of 7 aur record number 9 should b 8, something like that? is it possible?
@terryh558
@terryh558 6 жыл бұрын
I haven't watched that, but sounds like the ID is probably a primary key and you can't change those values. You delete one and that key is lost forever.
@MrPokerGaming
@MrPokerGaming Жыл бұрын
I'm 5 years late XD but u should use Auto number in your MS access data type
@wim2561
@wim2561 6 жыл бұрын
Those lesson were great they helped me a lot. But i find out that our teacher has some other goals now. (cry cry cry) I got only one question i cannot find a good way to work with stored procedure with in en output. Is it possible to explain that. Thanks in advance, and thank for your lesson. And my your new dreams come true.
@VBToolbox
@VBToolbox 6 жыл бұрын
Is the SP output a message or query results?
@wim2561
@wim2561 6 жыл бұрын
Thank for your answer. I am using SP for both but most are output. As it can be reports and also changes into the database. I have made one for testing but did do the scrip in VB. But, after lot of investing and reading, i have decide to take m project to C#. I wish you could help in that too. It is much harder than VB for me. But got results too. So the challenge is now to build my project in complet in C#. The reason for this decision is the chances of the roads which Microsoft will take in the near further. Thanks for all your effort. And hope to see you once more maybe as c#
VB.NET Tutorial - Dynamic Queries With An Access Database
1:03:08
VB Toolbox
Рет қаралды 21 М.
VB.NET Tutorial - Update Records In An Access Database
57:04
VB Toolbox
Рет қаралды 31 М.
Men Vs Women Survive The Wilderness For $500,000
31:48
MrBeast
Рет қаралды 103 МЛН
Cheap 5G Ethernet Has Landed!
7:23
Level 2 Jeff
Рет қаралды 117 М.
DELETE MS ACCESS RECORDS USING VB.NET
8:38
akosiDAN123
Рет қаралды 18 М.
VB.Net/2010 - How to save image in Database(Access)
14:25
TeraBytes
Рет қаралды 1 М.
How to Create a Delete Query to Delete Records from Tables in Microsoft Access
13:38
Men Vs Women Survive The Wilderness For $500,000
31:48
MrBeast
Рет қаралды 103 МЛН