DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   accessing ms access from VB (http://www.daniweb.com/forums/thread80193.html)

anud18 Jun 6th, 2007 1:56 am
accessing ms access from VB
 
hi....i m actually developing a tool which uses access as the database source...i hv created 2 coloumns in the database....username and password....now in my tool i need to ask the user fr his username and password....if it matches with any of the combinations stored in the database then the user can login ....cn anyone help me wiith dis ....

DenisOxon Jun 6th, 2007 6:02 am
Re: accessing ms access from VB
 
You need to open the Access table, and then step through each record testing the value the user has entered with the value in each record. If user name is same then check password to be same.

How far have you got with writing VB to open tables and read contents ?

anud18 Jun 6th, 2007 6:32 am
Re: accessing ms access from VB
 
actually i know the steps to do it......but m nt being able to figure out how to connect to the database by using ADO......wen i try to open the database using the following code it opens up a SELECT DATA SOURCE DIALOGUE BOX.....plz help me wid this

Dim dbUserName As Database
Dim rsUserName As Recordset

Set dbUserName = OpenDatabase(db1)

dbi is the database name stored on the desktop....
the third line of code which is posting a problem...

DenisOxon Jun 7th, 2007 6:32 am
Re: accessing ms access from VB
 
Quote:

Originally Posted by anud18 (Post 382015)
actually i know the steps to do it......but m nt being able to figure out how to connect to the database by using ADO......wen i try to open the database using the following code it opens up a SELECT DATA SOURCE DIALOGUE BOX.....plz help me wid this

Dim dbUserName As Database
Dim rsUserName As Recordset

Set dbUserName = OpenDatabase(db1)

dbi is the database name stored on the desktop....
the third line of code which is posting a problem...


For the momemnt where is db1 defined in your code ?


I have an application which does what you want. I will look it up tonight and post.

anud18 Jun 7th, 2007 6:44 am
Re: accessing ms access from VB
 
thanx.... i hv been able to develope the tool......now i further want to modify it...

i.e now i want to connect/open up the database which is password protected....how do i do that through VB

DenisOxon Jun 7th, 2007 7:37 am
Re: accessing ms access from VB
 
Quote:

Originally Posted by anud18 (Post 382969)
thanx.... i hv been able to develope the tool......now i further want to modify it...

i.e now i want to connect/open up the database which is password protected....how do i do that through VB


Thanks for letting us know.

I struggled to get a password protected database to open, so I won't guess but I'll look it up to night and post.

anud18 Jun 7th, 2007 7:48 am
Re: accessing ms access from VB
 
i wud be grateful 2 u....plz post it 2day

rumi Jul 25th, 2007 12:34 am
Re: accessing ms access from VB
 
hi,im a newbie in vb.im developing a small system for practical project.i've used adodc data control to connect from vb to the database.i want to send datas from the form ive created to my database.however,i kept facing the same error that says :
run-time error 91
Object variable or with block variable not set

here are my codings:
Private Sub Cmd_Submit_Click()

Adodc1.Recordset.AddNew

Adodc1.Recordset.Fields("Contact_No").Value = Txt_Contact.Text
Adodc1.Recordset.Fields("Reserv_No").Value = Txt_Reserv_No.Text
Adodc1.Recordset.Fields("Reserv_Date").Value = Txt_Date.Text
Adodc1.Recordset.Fields("Booking_Time").Value = Txt_Time.Text
Adodc1.Recordset.Fields("Type_Code") = Cmb_Type.ListIndex
Adodc1.Recordset.Fields("Payment") = Txt_Payment.Text
Adodc1.Recordset.Fields("Receipt_No") = Txt_Receipt.Text

Adodc1.Recordset.Update

MsgBox "Record has been saved", vbOKOnly + vbInformation

End Sub

can anyone please help me?im extremely new with this..thanx..

AV Manoharan Jul 26th, 2007 9:24 am
Re: accessing ms access from VB
 
Anud,

Please look in the thread Read Me. Access to any type of DB is possible
started by me.

Happy Programming
AV Manoharan

jireh Jul 26th, 2007 9:08 pm
Re: accessing ms access from VB
 
Quote:

Private Sub Cmd_Submit_Click()

Adodc1.Recordset.AddNew

Adodc1.Recordset.Fields("Contact_No").Value = Txt_Contact.Text
Adodc1.Recordset.Fields("Reserv_No").Value = Txt_Reserv_No.Text
Adodc1.Recordset.Fields("Reserv_Date").Value = Txt_Date.Text
Adodc1.Recordset.Fields("Booking_Time").Value = Txt_Time.Text
Adodc1.Recordset.Fields("Type_Code") = Cmb_Type.ListIndex
Adodc1.Recordset.Fields("Payment") = Txt_Payment.Text
Adodc1.Recordset.Fields("Receipt_No") = Txt_Receipt.Text

Adodc1.Recordset.Update

MsgBox "Record has been saved", vbOKOnly + vbInformation

End Sub

yoiu'll probably get an error if you do not set the datasource of that adodc!


All times are GMT -4. The time now is 10:46 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC