Please help access troubles

Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
mark

Comments

  • : Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
    : mark
    :

    So

    [code]Private Sub Form_Load()
    Dim myPassword As String, myDatabase As Database
    On Error GoTo flError
    myPassword = InputBox("Enter password:", "myDB.mdb")
    Set myDatabase = OpenDatabase(App.Path & "myDB.mdb", True, False, ";pwd=" & myPassword)
    Exit Sub
    flError:
    MsgBox Err.Description
    End
    End Sub[/code]The last parameter passes the password.
    InputBox is the easiest way how to get password if you want to get it on "form_load" and you don't want to make a login screen. InputBox can't show asterisks instead of chars by default but it's possible to manage it.

    PavlinII
  • : : Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
    : : mark
    : :
    :
    : So
    :
    : [code]Private Sub Form_Load()
    : Dim myPassword As String, myDatabase As Database
    : On Error GoTo flError
    : myPassword = InputBox("Enter password:", "myDB.mdb")
    : Set myDatabase = OpenDatabase(App.Path & "myDB.mdb", True, False, ";pwd=" & myPassword)
    : Exit Sub
    : flError:
    : MsgBox Err.Description
    : End
    : End Sub[/code]The last parameter passes the password.
    : InputBox is the easiest way how to get password if you want to get it on "form_load" and you don't want to make a login screen. InputBox can't show asterisks instead of chars by default but it's possible to manage it.
    :
    : PavlinII

    sorry i forgot to mension i do have a login screen and what i want is this :
    i have passeword my access database so you cannot enter it easily froom the dektop *or whereever it is installed) so what i need is the code for me to be able for it to say on form load o right there u and here is the password to enter you how would i do that.
    from
    mark

  • : : : Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
    : : : mark
    : : :
    : :
    : : So
    : :
    : : [code]Private Sub Form_Load()
    : : Dim myPassword As String, myDatabase As Database
    : : On Error GoTo flError
    : : myPassword = InputBox("Enter password:", "myDB.mdb")
    : : Set myDatabase = OpenDatabase(App.Path & "myDB.mdb", True, False, ";pwd=" & myPassword)
    : : Exit Sub
    : : flError:
    : : MsgBox Err.Description
    : : End
    : : End Sub[/code]The last parameter passes the password.
    : : InputBox is the easiest way how to get password if you want to get it on "form_load" and you don't want to make a login screen. InputBox can't show asterisks instead of chars by default but it's possible to manage it.
    : :
    : : PavlinII
    :
    : sorry i forgot to mension i do have a login screen and what i want is this :
    : i have passeword my access database so you cannot enter it easily froom the dektop *or whereever it is installed) so what i need is the code for me to be able for it to say on form load o right there u and here is the password to enter you how would i do that.
    : from
    : mark
    :
    :
    I'm sorry but my english looks uncompatible with yours.. I do not understand what you want... ;)

    Try to explain more detailed..
  • : : : : Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
    : : : : mark
    : : : :
    : : :
    : : : So
    : : :
    : : : [code]Private Sub Form_Load()
    : : : Dim myPassword As String, myDatabase As Database
    : : : On Error GoTo flError
    : : : myPassword = InputBox("Enter password:", "myDB.mdb")
    : : : Set myDatabase = OpenDatabase(App.Path & "myDB.mdb", True, False, ";pwd=" & myPassword)
    : : : Exit Sub
    : : : flError:
    : : : MsgBox Err.Description
    : : : End
    : : : End Sub[/code]The last parameter passes the password.
    : : : InputBox is the easiest way how to get password if you want to get it on "form_load" and you don't want to make a login screen. InputBox can't show asterisks instead of chars by default but it's possible to manage it.
    : : :
    : : : PavlinII
    : :
    : : sorry i forgot to mension i do have a login screen and what i want is this :
    : : i have passeword my access database so you cannot enter it easily froom the dektop *or whereever it is installed) so what i need is the code for me to be able for it to say on form load o right there u and here is the password to enter you how would i do that.
    : : from
    : : mark
    : :
    : :
    : I'm sorry but my english looks uncompatible with yours.. I do not understand what you want... ;)
    :
    : Try to explain more detailed..
    :
    Hi sorry i have not replied in such a long time i forgot about it sorry
    but what i have is a password and username login to actually enter my application which is to store customer's names and address and such like. But what i need to do is to have a pass word of say fish on my database so if i went to the directory where the database is installed and try to enter it it asks for a password what i need to no is how do i implement that password into the form load event so when i open my application it is able to access the database as it types the password in automatically if you no what i mean
    thx
    from
    mark
  • : : : : : Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
    : : : : : mark
    : : : : :
    : : : :
    : : : : So
    : : : :
    : : : : [code]Private Sub Form_Load()
    : : : : Dim myPassword As String, myDatabase As Database
    : : : : On Error GoTo flError
    : : : : myPassword = InputBox("Enter password:", "myDB.mdb")
    : : : : Set myDatabase = OpenDatabase(App.Path & "myDB.mdb", True, False, ";pwd=" & myPassword)
    : : : : Exit Sub
    : : : : flError:
    : : : : MsgBox Err.Description
    : : : : End
    : : : : End Sub[/code]The last parameter passes the password.
    : : : : InputBox is the easiest way how to get password if you want to get it on "form_load" and you don't want to make a login screen. InputBox can't show asterisks instead of chars by default but it's possible to manage it.
    : : : :
    : : : : PavlinII
    : : :
    : : : sorry i forgot to mension i do have a login screen and what i want is this :
    : : : i have passeword my access database so you cannot enter it easily froom the dektop *or whereever it is installed) so what i need is the code for me to be able for it to say on form load o right there u and here is the password to enter you how would i do that.
    : : : from
    : : : mark
    : : :
    : : :
    : : I'm sorry but my english looks uncompatible with yours.. I do not understand what you want... ;)
    : :
    : : Try to explain more detailed..
    : :
    : Hi sorry i have not replied in such a long time i forgot about it sorry
    : but what i have is a password and username login to actually enter my application which is to store customer's names and address and such like. But what i need to do is to have a pass word of say fish on my database so if i went to the directory where the database is installed and try to enter it it asks for a password what i need to no is how do i implement that password into the form load event so when i open my application it is able to access the database as it types the password in automatically if you no what i mean
    : thx
    : from
    : mark
    :
    So, you have one from (LoginScreen) where are 2 textboxes (txtName and txtPWD), 2 commands (cmdOK, cmdCancel)...
    I suppose you to have this form set like StarUp form and txtPWD.PasswordChar="*".
    You should just test if txtName.Text is valid and txtPWD.Text is valid... Function StrComp compares two strings. Where you have storaged valid names and passwords depends on you (table, code, file, ..).
    [code]Private Sub cmdOK_Click()
    if StrComp(txtName.Text, "YourName", vbBinaryCompare) = 0 And StrComp(txtPWD.Text, "YourPassword", vbBinaryCompare) = 0 Then
    MsgBox "OK"
    Load frmMain
    frmMain.Show
    Unload Me
    else
    If MsgBox ("Login Failed, do you want to try it again")=vbNo then
    DoCmd.Close 'Close application
    End if
    end if
    End Sub

    Private Sub cmdCancel_Click()
    DoCmd.Close
    End Sub
    [/code]
    This form is only loginscreen, the frmMain is th working form of your app..
    Writing name and password right into the code is NOT secure method!!
    You should save it into same table or to crypt them little.
    But this way is not too safety for your data. Anyone can open your database in edit mode and take a look inside tables, reports etc..

    More secure is Tools/Security/Set Database password..
    I suggest you to lock the folder (windows NT, 2k, XP with NTFS only).


    PavlinII



    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


  • : : : : : : Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
    : : : : : : mark
    : : : : : :
    : : : : :
    : : : : : So
    : : : : :
    : : : : : [code]Private Sub Form_Load()
    : : : : : Dim myPassword As String, myDatabase As Database
    : : : : : On Error GoTo flError
    : : : : : myPassword = InputBox("Enter password:", "myDB.mdb")
    : : : : : Set myDatabase = OpenDatabase(App.Path & "myDB.mdb", True, False, ";pwd=" & myPassword)
    : : : : : Exit Sub
    : : : : : flError:
    : : : : : MsgBox Err.Description
    : : : : : End
    : : : : : End Sub[/code]The last parameter passes the password.
    : : : : : InputBox is the easiest way how to get password if you want to get it on "form_load" and you don't want to make a login screen. InputBox can't show asterisks instead of chars by default but it's possible to manage it.
    : : : : :
    : : : : : PavlinII
    : : : :
    : : : : sorry i forgot to mension i do have a login screen and what i want is this :
    : : : : i have passeword my access database so you cannot enter it easily froom the dektop *or whereever it is installed) so what i need is the code for me to be able for it to say on form load o right there u and here is the password to enter you how would i do that.
    : : : : from
    : : : : mark
    : : : :
    : : : :
    : : : I'm sorry but my english looks uncompatible with yours.. I do not understand what you want... ;)
    : : :
    : : : Try to explain more detailed..
    : : :
    : : Hi sorry i have not replied in such a long time i forgot about it sorry
    : : but what i have is a password and username login to actually enter my application which is to store customer's names and address and such like. But what i need to do is to have a pass word of say fish on my database so if i went to the directory where the database is installed and try to enter it it asks for a password what i need to no is how do i implement that password into the form load event so when i open my application it is able to access the database as it types the password in automatically if you no what i mean
    : : thx
    : : from
    : : mark
    : :
    : So, you have one from (LoginScreen) where are 2 textboxes (txtName and txtPWD), 2 commands (cmdOK, cmdCancel)...
    : I suppose you to have this form set like StarUp form and txtPWD.PasswordChar="*".
    : You should just test if txtName.Text is valid and txtPWD.Text is valid... Function StrComp compares two strings. Where you have storaged valid names and passwords depends on you (table, code, file, ..).
    : [code]Private Sub cmdOK_Click()
    : if StrComp(txtName.Text, "YourName", vbBinaryCompare) = 0 And StrComp(txtPWD.Text, "YourPassword", vbBinaryCompare) = 0 Then
    : MsgBox "OK"
    : Load frmMain
    : frmMain.Show
    : Unload Me
    : else
    : If MsgBox ("Login Failed, do you want to try it again")=vbNo then
    : DoCmd.Close 'Close application
    : End if
    : end if
    : End Sub
    :
    : Private Sub cmdCancel_Click()
    : DoCmd.Close
    : End Sub
    : [/code]
    : This form is only loginscreen, the frmMain is th working form of your app..
    : Writing name and password right into the code is NOT secure method!!
    : You should save it into same table or to crypt them little.
    : But this way is not too safety for your data. Anyone can open your database in edit mode and take a look inside tables, reports etc..
    :
    : More secure is Tools/Security/Set Database password..
    : I suggest you to lock the folder (windows NT, 2k, XP with NTFS only).
    :
    :
    : PavlinII
    :
    :
    :
    : [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]
    :
    : [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]
    :
    :
    :
    Hi pav
    sorry i dont think you understand what i meant was i have a login on my project and that works fine what i want to do is password protect my database so no one can look in or change anything in the database and what i need in the form load event is to be able to give the database the password it needs to open and let me view the records
    from
    mark
  • : : : : : : : Hi all i have password protected my access database and what i need to do now is let it so when someone opens my programme it enters the password on form_load so it logs in to the database what coding would i need for this thanks for your time from
    : : : : : : : mark
    : : : : : : :
    : : : : : :
    : : : : : : So
    : : : : : :
    : : : : : : [code]Private Sub Form_Load()
    : : : : : : Dim myPassword As String, myDatabase As Database
    : : : : : : On Error GoTo flError
    : : : : : : myPassword = InputBox("Enter password:", "myDB.mdb")
    : : : : : : Set myDatabase = OpenDatabase(App.Path & "myDB.mdb", True, False, ";pwd=" & myPassword)
    : : : : : : Exit Sub
    : : : : : : flError:
    : : : : : : MsgBox Err.Description
    : : : : : : End
    : : : : : : End Sub[/code]The last parameter passes the password.
    : : : : : : InputBox is the easiest way how to get password if you want to get it on "form_load" and you don't want to make a login screen. InputBox can't show asterisks instead of chars by default but it's possible to manage it.
    : : : : : :
    : : : : : : PavlinII
    : : : : :
    : : : : : sorry i forgot to mension i do have a login screen and what i want is this :
    : : : : : i have passeword my access database so you cannot enter it easily froom the dektop *or whereever it is installed) so what i need is the code for me to be able for it to say on form load o right there u and here is the password to enter you how would i do that.
    : : : : : from
    : : : : : mark
    : : : : :
    : : : : :
    : : : : I'm sorry but my english looks uncompatible with yours.. I do not understand what you want... ;)
    : : : :
    : : : : Try to explain more detailed..
    : : : :
    : : : Hi sorry i have not replied in such a long time i forgot about it sorry
    : : : but what i have is a password and username login to actually enter my application which is to store customer's names and address and such like. But what i need to do is to have a pass word of say fish on my database so if i went to the directory where the database is installed and try to enter it it asks for a password what i need to no is how do i implement that password into the form load event so when i open my application it is able to access the database as it types the password in automatically if you no what i mean
    : : : thx
    : : : from
    : : : mark
    : : :
    : : So, you have one from (LoginScreen) where are 2 textboxes (txtName and txtPWD), 2 commands (cmdOK, cmdCancel)...
    : : I suppose you to have this form set like StarUp form and txtPWD.PasswordChar="*".
    : : You should just test if txtName.Text is valid and txtPWD.Text is valid... Function StrComp compares two strings. Where you have storaged valid names and passwords depends on you (table, code, file, ..).
    : : [code]Private Sub cmdOK_Click()
    : : if StrComp(txtName.Text, "YourName", vbBinaryCompare) = 0 And StrComp(txtPWD.Text, "YourPassword", vbBinaryCompare) = 0 Then
    : : MsgBox "OK"
    : : Load frmMain
    : : frmMain.Show
    : : Unload Me
    : : else
    : : If MsgBox ("Login Failed, do you want to try it again")=vbNo then
    : : DoCmd.Close 'Close application
    : : End if
    : : end if
    : : End Sub
    : :
    : : Private Sub cmdCancel_Click()
    : : DoCmd.Close
    : : End Sub
    : : [/code]
    : : This form is only loginscreen, the frmMain is th working form of your app..
    : : Writing name and password right into the code is NOT secure method!!
    : : You should save it into same table or to crypt them little.
    : : But this way is not too safety for your data. Anyone can open your database in edit mode and take a look inside tables, reports etc..
    : :
    : : More secure is Tools/Security/Set Database password..
    : : I suggest you to lock the folder (windows NT, 2k, XP with NTFS only).
    : :
    : :
    : : PavlinII
    : :
    : :
    : :
    : : [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]
    : :
    : : [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]
    : :
    : :
    : :
    : Hi pav
    : sorry i dont think you understand what i meant was i have a login on my project and that works fine what i want to do is password protect my database so no one can look in or change anything in the database and what i need in the form load event is to be able to give the database the password it needs to open and let me view the records
    : from
    : mark
    :
    ?? If you have your database protected by password, why do you need loginscreen? The access asks the password on every opening..
    Would you send me your database (without data) to let me see what you have done? (If you say yes, I'll send you ftp adress... and pls, if there is saved any password, change it to "asdf"..

    [gray]What Windows do you use? NT,XP,2k or 98?
    How do you login? To Group or Domain
    Where are the tables saved? In database file or SQL?
    If you use NT,XP or 2k and the tables are on SQL, you can simply make autologin by windows username..[/ray]

    PavlinII

    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories