473,466 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB6.0 Database Password HELP!!!

9 New Member
Private Sub Form_Load()
With Data1
.DatabaseName = App.Path + "\mydbase.mdb"
.RecordSource = "Select * from usertable"
.Refresh
End With
End Sub
--------------------------------------------------------------------------------
"mydbase.mdb" is created in Access97

im using a standard Data Component for "Data1"
And DBGrid Component for "DBGrid1"

DBGrid1 Properties is set to:
DataSource = Data1
--------------------------------------------------------------------------------
everything works fine but if i try set a password to my database
it gives me a

Run-Time error '3031': Not a valid Password.

does anybody knows the code to be able to access my database in this point
or can somebody help me in the code so that i may access my database with a password.

i must not make any major changes in the codes.

thanks in advance...
Jul 14 '06 #1
6 8863
Big K Hutch
11 New Member
Try this in the Click area.

Private Sub txtPassword_Change ()
If txtUser.Text <> "" Then
If txtPassword.Text <> "" Then
cmdOK.Enabled = True
Else: TxtPassword.SetFocus

End If
End If
End Sub
Jul 16 '06 #2
gman_00ph
9 New Member
Try this in the Click area.

Private Sub txtPassword_Change ()
If txtUser.Text <> "" Then
If txtPassword.Text <> "" Then
cmdOK.Enabled = True
Else: TxtPassword.SetFocus

End If
End If
End Sub
it doesnt have to do with textboxes.

i just the need the way to acces my Database using "Data1" -- Data Component.

Private Sub Form_Load()
With Data1
.DatabaseName = App.Path + "\mydbase.mdb"
?????.Password="mypassword"????? <--- something like this or other way
.RecordSource = "Select * from usertable"
.Refresh
End With
End Sub
Jul 17 '06 #3
gman_00ph
9 New Member
I open my access97 and set "mypassword" to mydbase.mdb

and then i re-run, i got this:

Run-Time error '3031': Not a valid Password.

help needed please...
Jul 17 '06 #4
sashi
1,754 Recognized Expert Top Contributor
Hi there,

kindly refer to below code segmet to be able to open password protected ms-access database..

since you are using DATA control.. you should be able to set the database password under the property window.. highlight the DATA control and press F4 key.. good luck my fren.. :)

Expand|Select|Wrap|Line Numbers
  1. Sub OpenDB()
  2.  Dim db As DAO.Database
  3.  Dim ws As DAO.WorkSpace
  4.  Dim rst As DAO.Recordset
  5.  Set ws = DBEngine.WorkSpaces(0)
  6.  Set db = ws.OpenDatabase _
  7.  ("C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb", _
  8.  False, False, "MS Access;PWD=northwind")
  9.  Set rst = db.OpenRecordset("Customers", dbOpenDynaset)
  10.  If rst.RecordCount > 0 Then
  11.    rst.MoveLast
  12.    MsgBox rst!CustomerID
  13.  End If
  14.  rst.Close
  15.  db.Close
  16. End Sub
  17.  
Jul 17 '06 #5
gman_00ph
9 New Member
since you are using DATA control.. you should be able to set the database password under the property window.. highlight the DATA control and press F4 key..
Just to let you know DATA Component doenst have database password under the property window. So im still hoping for that code...
Jul 26 '06 #6
Zery
1 New Member
Can someone tell me where to put a constant TRYMAX = 3 so that a user can only input the password 3 times,and after that,the form exits. the coding is:

rivate Sub Cmdexit_Click()
End
End Sub

Private Sub cmdValid_Click()

'This procedure checks the input password
Dim Response As Integer
If txtpassword.Text = txtpassword.Tag Then
'If correct, display message box
MsgBox "You've passed security!", vbOKOnly + vbExclamation, "Access Granted"
Else
'If incorrect, give option to try again
Response = MsgBox("Incorrect Password", vbRetryCancel + vbCritical, "Access Denied")
If Response = vbRetry Then
txtpassword.SelStart = 0
txtpassword.SelLength = Len(txtpassword.Text)
Else
End
End If
End If
txtpassword.SetFocus


End Sub

Private Sub Form_Activate()
txtpassword.SetFocus
End Sub
Jul 28 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Pat A | last post by:
We have a dilemma. We are storing our database password in an include file that resides outside of the web root. The password is in plain text. So, no one can get that password because it can't...
0
by: Z_799 | last post by:
Jim, You're connection string syntax is slightly wrong. Try the following: Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\temp\db1.mdb; Jet...
6
by: N. Graves | last post by:
Thank you for taking your time to read my question... please offer your knowledge it will be appreciated! I'm writing a ASP Web page to access a Access Database that has a Database Password set....
3
by: alijsyed | last post by:
I am trying to change an existing database password from VB 6. The database is an MS Access 2000 database if this helps How do I do this? Any help is appreciated.
1
by: Ryan | last post by:
Is there an accepted strategy/design for database password management? Multiple asp.net web applications all talking to the same database. Each web app is on a separate machine and connectivity...
5
by: scorpion53061 | last post by:
is it possible to set the database password that you can set in access for a database from a vb.net application?
21
by: Keith W | last post by:
I have some code which uses the now unsupported "ChrB" function. The code worked in A97 but does not with A2k3. Can anyone tell me what the following arguments equate to? Many thanks. ...
4
by: Hena | last post by:
Hi Any ideas how to use the repair option for a corrupted MS Access 2000 database which are on a network drive and used by several users, that has been password protected? On opening the...
16
by: Greg (codepug | last post by:
If one converts that .mdb into an .mde the code is secure but the tables can still be imported. Just for Very Basic protection, I have placed a Password on the database using the "Set Database...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.