13 Replies - 6064 Views - Last Post: 21 March 2010 - 11:53 AM Rate Topic: -----

#1 feelblue  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 27-September 09

how to connect to access with password

Posted 16 March 2010 - 10:34 AM

i have create a database table by using access 2003. and i set the database password, however when i connect with my visual basic 6, how should i write? because it keep pop out, invalid password
Is This A Good Question/Topic? 0
  • +

Replies To: how to connect to access with password

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: how to connect to access with password

Posted 16 March 2010 - 10:39 AM

Well show us what code you're using for connecting :)
Was This Post Helpful? 0
  • +
  • -

#3 feelblue  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 27-September 09

Re: how to connect to access with password

Posted 16 March 2010 - 10:49 AM

Dim abc As New ADODB.Connection
Dim abcd As New ADODB.Recordset
abc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db3.mdb"

Dim abc As New ADODB.Connection
Dim abcd As New ADODB.Recordset
abc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db3.mdb" 



something like this... my database is db3.mdb and table name is sid. inside sid got field name call code. this db3.mdb i set password as "123"

Admin Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

This post has been edited by PsychoCoder: 16 March 2010 - 12:48 PM

Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: how to connect to access with password

Posted 16 March 2010 - 12:49 PM

Try this

Dim abc As New ADODB.Connection
Dim abcd As New ADODB.Recordset
abc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db3.mdb;User ID=youruserid;Persist Security Info=False;JET OLEDB:Database Password=yourpassword"


Was This Post Helpful? 0
  • +
  • -

#5 Guest_elejal*


Reputation:

Re: how to connect to access with password

Posted 17 March 2010 - 02:06 AM

Public cn As New ADODB.Connection

cn.Provider = "microsoft.jet.oledb.4.0;Jet OLEDB:Database Password=yourpassword"
Was This Post Helpful? 0

#6 feelblue  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 27-September 09

Re: how to connect to access with password

Posted 17 March 2010 - 05:00 AM

i try both way but both also can't work: "data source name not found and no default driver specified"


in the pass time, i drag out a "data" control, then i straight link to database by type in the database name inside the properties menu.
data1.recordsource = select code from sid
by using this i can connect to it.

now, my database password is 123, path is c:newproject; database is db3.mdb. in side this database got 1 table call sid. inside sid got a field name call "code". how should i write for i can link to the database and call out the data?

This post has been edited by feelblue: 17 March 2010 - 05:00 AM

Was This Post Helpful? 0
  • +
  • -

#7 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: how to connect to access with password

Posted 17 March 2010 - 06:09 AM

use the Dim abc As New ADODB.Connection
like so
data1.recordsource = "select code from sid" , abc


Was This Post Helpful? 0
  • +
  • -

#8 feelblue  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 27-September 09

Re: how to connect to access with password

Posted 18 March 2010 - 06:56 AM

Dim abc As New ADODB.Connection
abc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db3.mdb;User ID=admin;Persist Security Info=False;JET OLEDB:Database Password=123"

[color="#0000FF"]data1.recordsource = "select code from sid" , abc[/color] 'problem:expected,end of statement

With Data1.Recordset
    .AddNew
    ![s_id] = Text1
    .Update
Data1.Refresh
End With
End Function



now i write like this but.. stil can't...
if i only write, data1.recordsource = select * from sid... then it will show.. want faint ad..
Was This Post Helpful? 0
  • +
  • -

#9 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: how to connect to access with password

Posted 18 March 2010 - 07:15 AM

try this "SELECT CODE FROM SID WHERE 1" and see if it will work. btw what is the error you encounter
Was This Post Helpful? 0
  • +
  • -

#10 feelblue  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 27-September 09

Re: how to connect to access with password

Posted 20 March 2010 - 05:06 AM

it show, object variable or with block variable not set
Was This Post Helpful? 0
  • +
  • -

#11 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: how to connect to access with password

Posted 20 March 2010 - 10:03 AM

use this
Dim abc As New ADODB.Connection
Dim data1 As New ADODB.Recordset
abc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db3.mdb;User ID=admin;Persist Security Info=False;JET OLEDB:Database Password=123"

[color="#0000FF"]data1.recordsource = "select code from sid" , abc[/color] 'problem:expected,end of statement

With Data1.Recordset
    .AddNew
    ![s_id] = Text1
    .Update
Data1.Refresh
End With
End Function



it is because you dont set the recordset to new or you dont declare it

This post has been edited by NoBrain: 20 March 2010 - 10:03 AM

Was This Post Helpful? 0
  • +
  • -

#12 feelblue  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 27-September 09

Re: how to connect to access with password

Posted 21 March 2010 - 01:26 AM

View PostNoBrain, on 20 March 2010 - 09:03 AM, said:

use this
Dim abc As New ADODB.Connection
Dim data1 As New ADODB.Recordset
abc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db3.mdb;User ID=admin;Persist Security Info=False;JET OLEDB:Database Password=123"

[color="#0000FF"]data1.recordsource = "select code from sid" , abc[/color] 'problem:expected,end of statement

With Data1.Recordset
    .AddNew
    ![s_id] = Text1
    .Update
Data1.Refresh
End With
End Function



thx for ur helping... but i still unsuccessful to do with it... if i dint set any password to the database, then i done, however when i put in the password then it become wired.. by the way, another question, did vb6 can link with access 2007, is there the same way to link it? now i am using access 2003.

it is because you dont set the recordset to new or you dont declare it

Was This Post Helpful? 0
  • +
  • -

#13 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: how to connect to access with password

Posted 21 March 2010 - 05:05 AM

check this link out
http://www.vbforums....hp?t=337051#ado

it is more or less the same as access 2003.
Was This Post Helpful? 0
  • +
  • -

#14 feelblue  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 27-September 09

Re: how to connect to access with password

Posted 21 March 2010 - 11:53 AM

View PostNoBrain, on 21 March 2010 - 04:05 AM, said:

check this link out
http://www.vbforums....hp?t=337051#ado

it is more or less the same as access 2003.


thx a lot... finally i get it. may i ask 1 more thing? i have saw your tutorial about flexgrid.
may i know how can i show database data on the flexgrid? let say my database is call id, fieldname is code, and in the field is 1,2,3,4,5
i want call out this database and show 1,2,3,4,5 in my grid
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1