Question

Connecting to an External db

Asked by: billcute

Assumming my db was locked out and no user is able to log in. However, I do have a backdoor routine in the back that can reset all the users.

However, since the db is an .mde, manual resetting may be impossible. In this case, I will like to login to the Server from a remote location...let's say from a local work Station in order to access the specific routine in that db that will reset all users.

I do have the sSql figured out as it's being utilized in my db when logged in thru backdoor and utilizing the specific routine ...I just need an idea on how to connect to the external db and .....

....run 3 sSql that will utilize the routine in the db being connected and reset user's passsword fields. Any help will be appreciated.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-06-11 at 06:04:38ID21882316
Tags

access

Topic

Microsoft Access Database

Participating Experts
4
Points
500
Comments
41

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. mde
    Under Tools, Database utilities I see repair, compact and make .mde : does this mean I don't need the ODE pack ? When trying to make the .mde it says that I should register an ActiveX. I do use an animated gif and probably it is refering to that one (stupid that it doesn't sa...
  2. MDEs - Worthwhile?
    I want to distribute (hopefully widely) a relatively simple database to users whom I probably won't even meet in person. I thought I might use a mde. The trouble is, I can't find much info on using them. The main question is: Do serious developers use MDEs? The main problem I...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: jefftwilleyPosted on 2006-06-11 at 07:15:32ID: 16880966

Create a macro inside your database before you create it as a .mde. Have this macro run a query that sets your passwords to a recovery set of user IDs and passwords. Then simply call this from a shell passing the backdoor userID and password and execute the macro.

Shell "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE c:\yourfile.mdb /x macroname"

Worth a shot!
J

 

by: billcutePosted on 2006-06-11 at 08:40:04ID: 16881198

Jeff,
You've suggested a macro, would you mind assisting with a format. Below is the info I have so far..

assuming the sSql are:

strSQL1 = "UPDATE tblSecurity SET Password = ........................................
strSQL2 = "UPDATE tblPasswords_old SEY Password= ............................
strSQL3 = Cal some function......

and...the code on my mind...to connect to the external db..

Function ConnectDB()
 Dim strDB As String
 Dim qry1 As DAO.QueryDef

    Const strConPath = "C:\Documents and Settings\Bill\Desktop\"

    strDB = strConPath & "KCombo.mdb"
    Set appaccess = CreateObject("Access.Application")
    appaccess.OpenCurrentDatabase strDB
    appaccess.Visible = False

    Note: ... how do I launch "Shell".... /x macroname"    ' <<<<<<<<------------- Take note
  ' .............................
  ' ...........................
 
End Function
' ************

Regards
Bill

 

by: billcutePosted on 2006-06-11 at 09:45:26ID: 16881347

Jeff,
I appreciated your suggestion ...I will prefer an "On Click event handler" procedure

Regards
Bill

 

by: LSMConsultingPosted on 2006-06-11 at 12:26:59ID: 16881777

After building your appAccess object, you can access the Connection to run your SQL:

appAccess.CurrentProject.Connection.Execute <your first sql here>
appAccess.CurrentProject.Connection.Execute <your second sql here>

As far as your function, you could build a macro in your mde that calls it, then use the appAccess object to Run the macro:

appAccess.DoCmd.RunMacro "your macro name"

Or, depending on what your function does, you could possibly move the code over to your external app ...

 

by: billcutePosted on 2006-06-11 at 15:26:29ID: 16882209

LSMConsulting,

Thanks for your suggested idea. I find the Macro method very difficult and trickish due to the fact that two functions has to be run at the same time. I tried it..I coudnt figure it out.

For Example, In my db, I usually call this function to reset a module's password as shown below.

Call ResetPassword("billcute", PerformEncryption("Abc123", True), Now())

(a). The ResetPassword function updates the module's password with encrypted Abc123 as password before saving
      into the module.

(b).  The function for encryption is "PerformEncryption"

.......but with Macro, I find it difficult to configure two functions at the same time
.....also with the strSql,
....the currently loaded frmMM is usually used by the currently logged on user.Admin using the txtUser field of the form to update tblSecurity.Password; and tblPasswords_old.Password and tblPasswords_ChengeDate fields.

I will appreciate help in modifying both the strSql and the Call to ResetPassword / PerformEncryption functions.

' *****Here is what I came up with using your suggestions above: Any corrections will be appreciated..******

 Function ConnectDB()
            Dim strSQL1 As String
            Dim strSQL2 As String
            Dim strDB As String

strSQL1 = "UPDATE tblSecurity SET Password = '" & sEncrypted & "' WHERE UserID = '" & Me.txtUser & "'"
strSQL2 = "UPDATE tblPasswords_Old (Password, ChangeDate) VALUES ('" & Me.txtUser & "','" & sEncrypted & "','" & Now() & "')"
   
    Set db = DBEngine.Workspaces(0).OpenDatabase(strDB)

    Const strConPath = "C:\Documents and Settings\Bill\Desktop\"
    strDB = strConPath & "KCombo.mdb"
        Set appAccess = CreateObject("Access.Application")
            appAccess.OpenCurrentDatabase strDB
            appAccess.Visible = False
            appAccess.CurrentProject.Connection.Execute sSq1
            appAccess.CurrentProject.Connection.Execute sSq2
            appAccess.DoCmd.RunCode ResetPassword("billcute", PerformEncryption(strPassword, True), Now())
            db.Close
    Set db = Nothing
    End Function
' *************

Regards
Bill'

 

by: bonjour-autPosted on 2006-06-12 at 00:26:37ID: 16883571

Hi Bill,

I am not really aware about the total security concept, but let me place two things here, which are not rlated to your direct question, but to the security situation:

1st: why would you be able to connect freely to your db. anybody from the network could do that too and get at the data in the mdb - i recommend to secure this, but it would have effct on your actual question off corse.

2nd: From another post i have noticed that your function PerformEncryption does just a little bit shifting in the characters, so do not see the plain text in the user-table. Anybody, wo has connected to the db from outside(see prvious point) and have a look at the table will be able to deduct the system behind.

if i  missed important additional facts about you security concept, above points may be just hot air.

regards, Franz

 

by: LSMConsultingPosted on 2006-06-12 at 04:34:52ID: 16884460

FWIW, I agree with Franz regarding this "security" ...

Regarding the PerformEncyryption function, I'd remove that call from your code and instead put it in the ResetPassword function, so that you can pass in plain text and the ResetPassword code would perform the encryption. This alleviates the need to call 2 items.

Do you mean that your SQL is pulling data from frmMM.txtUser? If so, you'd need to make sure that form is open:

Function ConnectDB()
            Dim strSQL1 As String
            Dim strSQL2 As String
            Dim strDB As String
            Dim frm As Form

'/find frmMM
For Each frm in appAccess.AllForms
  If frm.Name = "frmMM" then exit for
Next

If frm Is Nothing or frm.IsLoaded=False then
  msgbox "Could not find data."
  Exit Function
End If

'not sure where your sEncrypted comes from ...
strSQL1 = "UPDATE tblSecurity SET Password = '" & sEncrypted & "' WHERE UserID = '" & frm.txtUser & "'"
strSQL2 = "UPDATE tblPasswords_Old (Password, ChangeDate) VALUES ('" & frm.txtUser & "','" & sEncrypted & "','" & Now() & "')"
   
    Const strConPath = "C:\Documents and Settings\Bill\Desktop\"
    strDB = strConPath & "KCombo.mdb"

'you aren't using the db object, so no reason to open it  
'Set db = DBEngine.Workspaces(0).OpenDatabase(strDB)

        Set appAccess = CreateObject("Access.Application")
            appAccess.OpenCurrentDatabase strDB
            appAccess.Visible = False
            appAccess.CurrentProject.Connection.Execute sSq1
            appAccess.CurrentProject.Connection.Execute sSq2
            appAccess.DoCmd.RunCode ResetPassword("billcute", PerformEncryption(strPassword, True), Now())
            'note: if the above doesn't work, try building
            'db.Close
            'Set db = Nothing
    appAccess.Quit
    Set appAccess = Nothing
End Function


 

by: billcutePosted on 2006-06-12 at 15:17:11ID: 16889957

LSMConsulting / Franz,
Thanks for your suggestion. I will likely explore the possibilities with a new thread once this post has closed.

I tested the above code and commented the strSql for now.
(1).
I received a Run-timr error '424": "Object required"

...and the debug highlighted..

For Each frm in appAccess.AllForms

Although, I placed both ResetPassword and performEncryption routines in my test sample. I am strongly of the opinion that the two functions should be inside the target db...in this case KCombo.db - the reason being that the
ResetPassword function is expected to hold the changed password. Once the target db's backdoor password is reset,
it will be easier to reset other users.

Here is the logic I am trying to achieve.

1. Connect to the target db from a remote location
2. When connected find first function ResetPassword and PerformEncyption
3. When the two functions are found, then reset billcute's password to Abc123

This should do it.

Regards
Bill

 

by: LSMConsultingPosted on 2006-06-12 at 15:30:23ID: 16890031

You'd have to build the appAccess variable first:

Function ConnectDB()
            Dim strSQL1 As String
            Dim strSQL2 As String
            Dim strDB As String
            Dim frm As Form

Const strConPath = "C:\Documents and Settings\Bill\Desktop\"
strDB = strConPath & "KCombo.mdb"

Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB

'/find frmMM
For Each frm in appAccess.AllForms
  If frm.Name = "frmMM" then exit for
Next

If frm Is Nothing or frm.IsLoaded=False then
  msgbox "Could not find data."
  Exit Function
End If

'not sure where your sEncrypted comes from ...
strSQL1 = "UPDATE tblSecurity SET Password = '" & sEncrypted & "' WHERE UserID = '" & frm.txtUser & "'"
strSQL2 = "UPDATE tblPasswords_Old (Password, ChangeDate) VALUES ('" & frm.txtUser & "','" & sEncrypted & "','" & Now() & "')"
   

'you aren't using the db object, so no reason to open it  
'Set db = DBEngine.Workspaces(0).OpenDatabase(strDB)

             appAccess.Visible = False
            appAccess.CurrentProject.Connection.Execute sSq1
            appAccess.CurrentProject.Connection.Execute sSq2
            appAccess.DoCmd.RunCode ResetPassword("billcute", PerformEncryption(strPassword, True), Now())
            'note: if the above doesn't work, try building
            'db.Close
            'Set db = Nothing
    appAccess.Quit
    Set appAccess = Nothing
End Function

 

by: billcutePosted on 2006-06-12 at 16:33:00ID: 16890421

LSM,
I tested your last suggestion and I received a Run-time error code '7856':

"Microsoft Office cant open the database because it is missing or it's opened exclusively by another user.

I am positive that the db is not opened in any way and that it is not misspelled.

debug highlighted...

appAccess.OpenCurrentDatabase strDB


...besides

(2). Is there any way to have your code do a llokup for the two functions mentioned earlier in my previous post and
      when found utilize the function to saves changes to the stored code in the module ?

ResetPassword..it's a function that uses DB_TEXY to store billcute's password in the module. Moreover,

(3).   how do I pass specific password say Abc123 to replace what is in the target module of "KCombo.mdb"

Regards
Bill

 

by: billcutePosted on 2006-06-13 at 04:33:08ID: 16893149

LSMConsultin,
Per your other question on ..'not sure where your sEncrypted comes from ...
' *****
 Dim sPassword As String
 Dim sEncrypted As String
 sEncrypted = PerformEncryption("sPassword", True)

...now for the strSql:

strSQL1 = "UPDATE tblSecurity SET Password = '" & sEncrypted & "' WHERE UserID = '" & frm.txtUser & "'"
strSQL2 = "UPDATE tblPasswords_Old (Password, ChangeDate) VALUES ('" & frm.txtUser & "','" & sEncrypted & "','" & Now() & "')"

Regards
Bill

 

by: LSMConsultingPosted on 2006-06-13 at 04:50:22ID: 16893231

<I am positive that the db is not opened in any way and that it is not misspelled.>

If your db isn't open, how do you plan on getting information from a form contained within it? Once it's opened, how does frmMM populate? Does this happen when the database loads? If so, you may very well have some timing issues to deal with ...

Did you check your processes in the Task Manager? Everytime I code automation stuff, invariably I end up with several different instances of msaccess.exe (since the code bombs out and the process isn't closed).

Your strSQL2 is attempting to set 3 values, and only 2 columns are declared. Those values must match - if you're setting 3 values, you need to declare 3 columns which will receive the data.

What exactly does your ResetPassword routine do?

On a side note:

Are you trying to build a utility that will reset user passwords externally? If so, I'm not sure of the reasoning for putting the code for that utility in the db being changed. Typically a "tool" such as what you're trying to build would have all it's code internal ... and would open a connection to your database (via ADO or DAO, not through automation) OR simply link the table, and then manipulate the tables directly. If ALL you're doing is resetting the password, then that's the easiest way to do this. Move the code to your "tool" and then set the values from that tool. You can put your encryption and password reset routines and such in the "tool" and even link to the datatables needed.

 

by: billcutePosted on 2006-06-13 at 05:06:03ID: 16893340

LSMConsulting,
I understood your point..so I have desided to narrow down my question only to change the password in the  ResetPassword function of KComboDb.mdb to Abc123 from an external mdb..

so the code you assisted earlier with will be...

Function ConnectDB()
/ Note that opening frmMM is no longer required..in KComboDB.mdb....they are only important for the strSQL..

            Dim strSQL1 As String
            Dim strSQL2 As String
            Dim strDB As String
            Const strConPath = "C:\Documents and Settings\Bill\Desktop\"
            strDB = strConPath & "KCombo.mdb"

             Set appAccess = CreateObject("Access.Application")
             appAccess.OpenCurrentDatabase strDB  
             appAccess.Visible = False
             appAccess.DoCmd.RunCode ResetPassword("billcute", PerformEncryption(strPassword, True), Now())
            'note: if the above doesn't work, try building
            'db.Close
            'Set db = Nothing
    appAccess.Quit
    Set appAccess = Nothing
End Function
' ********

ResetPassword function utilizes the DB_TEXT to store user.billcute and password Abc123 in it's module.

If you can assist just with the process of changing billcute's password in the ResetPassword from a remote Db, I can handle the rest.

Regards
Bill

 

by: LSMConsultingPosted on 2006-06-13 at 05:10:26ID: 16893357

Do you still get the error when trying to open the database here:

appAccess.OpenCurrentDatabase strDB

 

by: billcutePosted on 2006-06-13 at 05:14:43ID: 16893380

No I have not tested it yet...my major concern is being able to fix the line below...

appAccess.DoCmd.RunCode ResetPassword("billcute", PerformEncryption(strPassword, True), Now())

once connected to KComboDB.mdb, I want to change billcute's password to Abc123 something like.

Dim strPassword As String
strPassword = Abc123

appAccess.DoCmd.RunCode ResetPassword("billcute", PerformEncryption(strPassword, True), Now())

I am sure...,my coding is wrng...need the right expression..

Regards
Bill

 

by: billcutePosted on 2006-06-13 at 05:20:55ID: 16893418

okay,
I have just tested the code with these two lines added

Dim strPassword As String
strPassword = Abc123

....and I received a Run-time error '7866'

"Microsoft Office cant open the database because it is missing or it's opened exclusively by another user.

debug highlighted...

appAccess.OpenCurrentDatabase strDB
' ******

...when I removed the two added lines above...I received.. a compile error
ByRef..Argument type mismatch

...on strPassword..

 

by: LSMConsultingPosted on 2006-06-13 at 05:27:46ID: 16893461

Try using this:

appAccess.Run ResetPassword, "billcute",  PerformEncryption(strPassword, True), Now()

Note the difference in the way it's called ... the Run method accepts up to 30 arguments, but they MUST be comma separated ... not sure how it will work with your variables,

You may also need to breakout your PerformEncryption call and place the value in a variable

Function ConnectDB()
/ Note that opening frmMM is no longer required..in KComboDB.mdb....they are only important for the strSQL..

           Dim strEncryptedPassword
           Dim strDB As String
            Const strConPath = "C:\Documents and Settings\Bill\Desktop\"
            strDB = strConPath & "KCombo.mdb"

             Set appAccess = CreateObject("Access.Application")
             appAccess.OpenCurrentDatabase strDB  
             appAccess.Visible = False
             '/first get the encrypted password
             strEncryptedPassword = appAccess.Run "PerformEncyryption", strPassword, "True"
             '/now reset
             appAccess.Run "ResetPassword", "billcute", strEncryptedPassword, "Now()"
             appAccess.Quit
             Set appAccess = Nothing
End Function

 

by: LSMConsultingPosted on 2006-06-13 at 05:30:32ID: 16893481

You set a string variable like this:

Dim strPassword As String
strPassword = "Abc123"

Also, please post the value of your strDB variable ...

 

by: billcutePosted on 2006-06-13 at 05:31:24ID: 16893490


the line below was highlighted in red..

strEncryptedPassword = appAccess.Run "PerformEncyryption", strPassword, "True"

 

by: LSMConsultingPosted on 2006-06-13 at 05:33:03ID: 16893499

Try enclosing strPassword in quotes:

strEncryptedPassword = appAccess.Run "PerformEncyryption", "strPassword", "True"

 

by: LSMConsultingPosted on 2006-06-13 at 05:33:50ID: 16893506

May need to do the same in the second call to Run ...

 

by: billcutePosted on 2006-06-13 at 05:35:24ID: 16893519

...I also noticed in your last posted code that "user.billcute" has no password defined - i.e Abc123.
I wanted to reset user.billute's password to Abc123

 

by: LSMConsultingPosted on 2006-06-13 at 05:38:36ID: 16893544

You will, of course, have to change the code I provide to match your table/field names, as well as the propery syntax you need ... if I add "billcute" and you need it to be "user.billcute", just change the name to match your own. i have no idea what your nameing conventions and such are ...

 

by: billcutePosted on 2006-06-13 at 05:43:54ID: 16893585

okay I your latest suggestion.....it did not resolve the "red" line error...

I now receive a compile error..."Expected: end statement

on..

"PerformEncyryption",

from:
strEncryptedPassword = appAccess.Run "PerformEncyryption","strPassword", "True"


I also tried  this..

strEncryptedPassword = appAccess.Run PerformEncyryption("strPassword", True)    ...or
strEncryptedPassword = appAccess.Run PerformEncyryption(strPassword, True)

....it did not make any difference...the line is still in red.

 

by: billcutePosted on 2006-06-13 at 05:45:53ID: 16893604

"user.billcute",   is what I am using as a figure of speech....the correct syntax remains as is... no changes.

appAccess.DoCmd.RunCode ResetPassword("billcute", PerformEncryption(strPassword, True), Now())

 

by: LSMConsultingPosted on 2006-06-13 at 05:49:41ID: 16893645


strEncryptedPassword = appAccess.Run ("PerformEncyryption","strPassword", "True")

 

by: billcutePosted on 2006-06-13 at 15:59:51ID: 16898550

LSMConsulting ,

I have also tested this very last suggested code...and I am still getting the Run-time error 7866.

Regards

 

by: rockiroadsPosted on 2006-06-20 at 01:30:24ID: 16940492

LSMConsulting, Bill has asked me to have a look, so please don't feel Im hijacking this thread.,

Bill

LSMConsulting is on the right path here, I guess its how one can implement it. But one thing to note, I don't know if this works on an MDE or not.

First create a public function. I am using dummy code so as to give you an idea


Public Function PswdReset()

    DoCmd.RunSQL "INSERT INTO Table1 ('Test')"
   
End Function


Next create a macro, lets call it PReset
This has just one line in it. Its of type RunCode and it calls          PswdReset ()

Now in your calling code, all u do is run the Macro


e.g.

    Dim acc As Access.Application
   
    Set acc = New Access.Application
    acc.OpenCurrentDatabase ("C:\EE\Temp\ExcelAuto.mdb")
    acc.DoCmd.RunMacro "PReset"
    acc.CloseCurrentDatabase
    Set acc = Nothing



This is as the other experts have said


Now in the function PswdReset, what I have done is just created a dummy insert statement.
What you need to do is add your password reset code in here. Currently though, using this approach, it is fixed to one password.
But you should try something like this just to get you going.

Can I suggest as a test, you create a dummy table called Table1, and it has just the one text field in it called Txt.
Then try it using that insert. If it works, the u know your on the right track. You can then add in your code that resets the password



Now in this DB of yours that is doing the calling, does it have PerformEncryption in it? The reason why I suggested just creating one function that does all the work is that you don't have to copy any of the other functions used by that remote db.


 

by: billcutePosted on 2006-06-20 at 03:47:38ID: 16941089

rockiroads,
Thanks for your input. Here is how I used your suggestion.

I created a module (basResetPwsd) and the plave this call in it...

Public Function PswdReset()
Call SavePassword("billcute", EncryptDecrypt(PerformEncryption("Abc123", True)), Now())
End Function

(2). I created a macro (ResetPwsdMacro)
       selected RunCode from the list and supplied function to run

         PswdReset()

I created a form and placed your suggested code in it as follows:

  Private Sub btnLinkFE_Click()
Dim acc As Object
   Dim strFullFilePath As String
'
    Set acc = CreateObject("Access.Application")
   
    acc.OpenCurrentDatabase "C:\Development\Queensdata_Fe.mdb"   'specify path of remote DB
    Call SavePassword("billcute", EncryptDecrypt(PerformEncryption("Abc123", True)), Now())

    acc.DoCmd.RunMacro "ResetPwsdMacro"    'run macro MyMacro
    acc.DoCmd.runcode
    Set acc = Nothing

End Sub
' ***********

Your suggested code opened the target mdb...but did not reset the password...

I received a Run-time Error '2001':
You cancelled the previous operation.


on..

acc.DoCmd.RunMacro "ResetPwsdMacro"    'run macro MyMacro

Am I doing something wrong?

Regards
Bill
       

 

by: rockiroadsPosted on 2006-06-20 at 04:53:34ID: 16941412

You don't need to call SavePassword on the caller


 Private Sub btnLinkFE_Click()
Dim acc As Object
   Dim strFullFilePath As String
'
    Set acc = CreateObject("Access.Application")
   
    acc.OpenCurrentDatabase "C:\Development\Queensdata_Fe.mdb"   'specify path of remote DB

'THIS LINE IS NOT REQUIRED AS U RUN IT ON THE REMOTE DB
    'Call SavePassword("billcute", EncryptDecrypt(PerformEncryption("Abc123", True)), Now())

    acc.DoCmd.RunMacro "ResetPwsdMacro"    'run macro MyMacro

'THIS LINE IS NOT REQUIRED AS U ARE RUNNING A MACRO
    'acc.DoCmd.runcode
    Set acc = Nothing

End Sub

 

by: LSMConsultingPosted on 2006-06-20 at 04:57:48ID: 16941450

Thanks rocki, I've been quite busy lately and (sorry billcute) simply forgot about this thread ... please continue <g> ...

 

by: billcutePosted on 2006-06-20 at 04:59:39ID: 16941466

LSMConsulting,
Thanks

Regards
Bill

 

by: billcutePosted on 2006-06-20 at 05:07:07ID: 16941528

rockiroads,
Sorry, I actually forgot the line code in error when posting my comment...I had tried all options before providing you a feedback.

My comment above still stand.. I tested again after removing the extra code..I still received..

I received a Run-time Error '2001':
You cancelled the previous operation.

on..
acc.DoCmd.RunMacro "ResetPwsdMacro"    'run macro MyMacro

Regards
Bill

 

by: rockiroadsPosted on 2006-06-20 at 05:17:48ID: 16941604

Bill, when u run this code on the remote db


Public Function PswdReset()
    Call SavePassword("billcute", EncryptDecrypt(PerformEncryption("Abc123", True)), Now())
End Function


does it work?

I don't have the code to SavePassword hence my INSERT statement as a test.


 

by: rockiroadsPosted on 2006-06-20 at 05:18:59ID: 16941615

also try running your macro  

ResetPwsdMacro

confirm that they both work

 

by: billcutePosted on 2006-06-20 at 18:43:04ID: 16947953

rockiroads,
Brilliant idea - it didnt even cross my mind to run that test at first.
(1)
I first doubleclick on the macro in my Front End and tested billcute's password...it was reset to Abc123

(2). I also tried ran function PwsdReset from and On Click Event of the same db...it also reset the password.

I assume the problem is the fact that the Remote DB first opens the db before attempting to reset password...

If it is possible to link to the Front End from the remote location then launch the macro without having to first open the Front end db might resolve the impasse.

Regards
Bill

 

by: rockiroadsPosted on 2006-06-20 at 23:29:10ID: 16948850

How is your password stored for billcute, is it part of the database property? I am assuming soif so then linking it wont have any affect

have u tried opening the DB as exclusive?


acc.OpenCurrentDatabase "C:\Development\Queensdata_Fe.mdb", True

 

by: billcutePosted on 2006-06-21 at 03:55:27ID: 16950100

rockiroads,
Thanks..your last suggested tweak to your code it worked...

Private Sub btnLinkFE_Click()
Dim acc As Object
   Dim strFullFilePath As String
    Set acc = CreateObject("Access.Application")
    acc.OpenCurrentDatabase "C:\Development\Queensdata_Fe.mdb", True  'specify path of remote DB
    acc.DoCmd.RunMacro "ResetPwsdMacro"    'run macro MyMacro
    Set acc = Nothing
'Shell "C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE c:\Development\Queensdata_Fe.mdb /x ResetPwsdMacro"
End Sub

Is it possible to connect the target db without opening the db?

Regards
Bill

 

by: billcutePosted on 2006-06-21 at 04:00:17ID: 16950127

I want to thank all experts here for their contribution.

I will also to say that I will be opening  a followup on this same topic..and will appreciate further assistance.

Regards
Bill

 

by: billcutePosted on 2006-06-21 at 04:15:56ID: 16950238

Note:
As you would notice in my last post, I also tried "JeffWilley" suggestion and it worked but I prefer rockiroads version for two reasons:
(a). Version setting of Ms. Access is not required
(b). User may be running on the run-time version of an Ms.Access

In this case, I will be splitting the points.

Regards
Bill

 

by: rockiroadsPosted on 2006-06-21 at 12:19:39ID: 16954432

Is it possible to connect the target db without opening the db?

Dont know, the only way I know how with regards to what you want to do is to open it up

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...