Private Sub btn_addc_Click()
 On Error Resume Next
If Me.txtAddc.Text = "" Then
MsgBox "Please fill up", vbInformation, "ADD CATEGORY"
Exit Sub
End If

If Me.btn_addc.Caption = "ADD" Then
If rs.State = adStateOpen Then rs.Close
rs.Open " Select * From tbl_category WHERE CategoryList ", db, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
       MsgBox "The Category you have entered is already Existed", vbCritical, "Error"
            btn_refresh_Click
            Me.txtAddc.Text = ""
            Me.txtAddc.SetFocus
Else

With rs
    .AddNew
    .Fields("CategoryList") = Me.cmb_addc.Text
    .Update
End With
MsgBox " Category Successfully Added.", vbInformation, "CATEGORY"
btn_refresh_Click
End If
End If
End Sub

Why do you assume that if RecordCount is greater than zero the record already exists?
Do you not allow to update existing records?
Your indentation is bad, Very bad. Very bad. (Paraphrasing an Amrican...)
Assuming you are using Visual Studio, set breakpoints and dive into a wonderful debugger to watch what your variables are doing.

commented: Armenian is better on this. Շատ վատ. Shat vat! +14

This type of post is getting to be standard on this site. If there is a point to it, we're left to guess what that point is. It's annoying. I see it tagged with "Visual Basic 6", which I know next to nothing about EXCEPT that Microsoft told everyone not to write anything new in it years ago (Wikipedia puts the date at TEN years ago).

So we have a brand new user joining 15 hours ago and making a single contribution in a deprecated language with cryptic language about how it's part of a "thesis" and posting a single subroutine that no one, as far as I can tell, can use, if that was the intent. If it was a QUESTION, we're left to spend time wondering what the question is. We're not mind readers. If it's a TUTORIAL, see comment about Visual Basic 6 being deprecated.

Pardon me if this strikes you as a "You kids get off my lawn" screed. I simply fail to see the point of the post. If there is one, please do elaborate. If not...

commented: A thesis based on something from 1998. Must be an archaeology student. +14

@AssertNull: You are 100% right. I can't prove it, but I guess there are some parts in the world where they still teach VB6 and Turbo C++ on older computer systems. Why? The governments like to spend more money on weapons than on education... :(

@rproffitt: Why does this person always says a phrase twice? Does he twitter twice also? Wat is Shat vat? The rest of the armenian I ubderstood.

@ddanbe. Շատ վատ translates to "very bad." I found this humorous in light of what you wrote earlier. The non-Armenian text was equally funny.

That aside, last month I updated a VB6 app that is on long term support for our office. I refuse to write anything new in VB6 (heresy to some?) but since the client pays well (some would say too well) we keep a pair of XP laptops in storage just for when we need to change what they ask for. Money talks.

The governments like to spend more money on weapons than on education... :(

Compilers and Visual Studio and other IDEs are free though for pretty much everyone but businesspeople. Certainly free for developers and students. I have Visual Studio on my computer somewhere, which I believe has Visual Basic on it, though not Visual Basic 6. All free. I may not have the whizbang version and I may have had to jump through a couple of very minor hoops to get it for free, but it wasn't much, and I'm not even a student. Pretty sure Microsoft makes it as easy and cheap as possible for the computer lab folks to stick MS Office and Visual Studio on the machines, at least at the good, accredited universities as opposed to the fly-by-night ones. It's in their best interest to get students used to using Microsoft products in the hope that when they're actually BUYING software as professionals later, well you go with what you know, right? As for Turbo C++, CodeBlocks and NetBeans are out there COMPLETELY free with NO hoops to jump through, bundled with modern compilers.

In summary, I can't think of ANY reason why a legit professor at a legit university who is trying to prepare students properly anywhere in the world would encourage Visual Basic 6 for a student doing a new "thesis". I suppose if I tried really hard I could think of a legitimate exception, but certainly not for the code above. And that's without me knowing anything about Visual Basic 6.

No, this is nothing more than lazy professors committing malpractice by knowingly using software that will put their students at a disadvantage so they won't have to put in the effort to stay current themselves. Not sure what country the OP is from, but India seems to be the worst offender. There's no shortage of Indian graduate students getting into very prestigious American Computer Science programs like Stanford, so someone is doing something right over there. I doubt THOSE folks are using Visual Basic 6. It could, however, be that most of the resources get spent on a relatively small group of people and there is not much left over for, say, the Junior College level. I'm not familar enough with their educational system to know.

In America, I'm quite comfortable calling any professor teaching new students a deprecated language a lazy selfish bum. It takes hardly any effort to get the good stuff here.

EDIT: Caveat: I'm not talking about folks using a deprecated language for some actual purpose where it proves some point the professor is making or is useful in a theoretical class or whatever. I'm talking about the guy who learned Modula 2 in the 80's and teaches it instead of C++ because that's what he happens to know and not caring that there's not much call from employers in 2018 for entry level Modula 2 programmers.

I worked for a water compagny and programmed in Modula-2 starting in 1985. The main computer was an IBM RS6000, the clients were Macs with sytem 7. Worked with two other programmers and wrote programs to collect data from pumping stations and laboratory analysis data and turned those into reports for the managers to make decisions on it. It were 6 years of joy for me to participate in this.
Although I consider Modula-2 still to be a nice language, I would indeed not advise someone nowadays to start learning it, unless you are just curious.
For the moment I am amusing myself with F# trying to make another old language in it, namely FORTH.
Hope I succeed, if not, ha well: the journey is sometimes better than the destination.

unless you are just curious.

...

amusing myself

...

the journey is sometimes better than the destination.

Agreed. I'm guessing we're on the same page here. Everyone needs a hobby. If you're financially secure and CHOOSE to spend your free time learning languages that will likely never land you a job but do it anyway to "scratch the itch", cool... My beef is with professors inflicting that choice on inexperienced students with NO money, NO perspective, NO experience, etc., who then stick "Modula 2" and "Visual Basic 6" on their resumes looking for an entry level programming job, with predictable results.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.