Click to See Complete Forum and Search --> : help! want to use something other than default data controls
I'm fairly new to VB, and I was wondering how to use an object other than the default data controls to sort through a database. In other words, I would like to be able to make the "Data" object invisible, and use a drop down list to sort through a particular column, thus changing which row is active (so it would change the other things on the form that are affected by changing which row of the Db is active).
Thanks for any help,
Mr.T3
Clunietp
Apr 16th, 2000, 12:08 AM
Since you are new to VB (and therefore probably new to ADO), start here:
http://msdn.microsoft.com/library/psdk/dasdk/mdat3n3g.htm
I appreciate the info, but I'm too busy (and lazy) to learn a bunch of new things right now. Could you just explain how I could do what I need? I have a huge book on VB, but it doesn't explain how to do this, or if it does, I can't find it :). Most of the tutorials and books I've found give really round-about complicated ways of explaining simple things. I was just looking for a real-life explanation for someone who ISN'T a VB pro.
Mr.T3
Clunietp
Apr 16th, 2000, 11:52 PM
I suppose since you are really lazy, you could set the Visible property of the data control to FALSE, and not have to learn a single thing.....
If you come across a way that I can learn without putting in any effort, PLEASE let me know, because I've been doing it wrong this whole time! :)
I knew how to make something invisible, but I'd like to know how to use a different object to control the database besides the default data-control without reading a 500 page manual (which I have).
Thanks,
Mr.T3
I'm sorry if I've been a little rude about any suggestions that have been made. I do have the resources to learn VB extensively, and realize that you people would appreciate us being able to learn on our own, but I lack the time to do so. I would like to be able to more fully understand the language and program, but I have my schoolwork among other things that are higher on my agenda. Again, I thank all of you for any suggestions, and resources you have pointed me to, but I would really just like to know how to do a few specific things at the present time. Perhaps I can learn how to use the language more efficiently in the near future, but I would just like to be able to complete this simple project with the time I have at hand.
Thanks again,
Mr.T3
If you dont want to use a data control object then you have to use SQL statements most notable the SELECT heres an example
Dim db As Database
Dim rs As Recordset
'open database
Set db = DBEngine.OpenDatabase("NWind2k.mdb")
'open recordset using SQL LIKE
Set rs = db.OpenRecordset("Select * from Customers where CustomerID like '*" & text1.text & "*'")
'add all results to listbox
Do Until rs.EOF = True
List1.AddItem rs.Fields("CustomerID").Value
rs.MoveNext
Loop
'close db/rs
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
I found this in another thread. Learning SQL is not a simple thing.
Wow! My brain hurts now! This could take longer than I expected.
Mr.T3
It Really isn't all that complicated... Check out this 4 page article... it has nice simple examples... and a reference to the microsoft SQL references to find what you need... I just started working on a database a week ago and this little article has gotten me over the main parts
http://vbsquare.com/databases/begado/index.html
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.