Opening form in different Database using criteria from First Database

TylerTand

Registered User.
Local time
Yesterday, 22:11
Joined
Aug 31, 2007
Messages
95
I have two separate databases. I need to be able to open database 2 using a criteria of a field on a form from Database 1. I have successfully used the shell command to actually open database 2 but I can't get the correct form with filtered information to open. I have used the following code behind a button:

Dim Varset, varpath
Set Varset = DBEngine.Workspaces(0).OpenDatabase("S:\RESET\IB Station Module\DSA USE ONLY\IB Intelligence_be.mdb").OpenRecordset("Select LogIn.* from LogIn Where Login.[Hash ID] = '" & Environ$("username") & "';")
If Varset.EOF Then
MsgBox "User does not have an account. For access email rudy@madeup.com", vbCritical, "Invalid User Account"
DoCmd.Quit
Else
varpath = """c:\program files\microsoft office\office\office11\msaccess.exe"" ""s:\RESET\IB Station Module\DSA USE ONLY\IB Intelligence.mdb"" /wrkgrp ""s:\RESET\IB Station Module\DSA USE ONLY\security.mdw"" /user "
If Varset!Permission = 1 Then varpath = varpath & "agent /pwd randjont"
If Varset!Permission = 2 Then varpath = varpath & "Supervisor /pwd randjont"
If Varset!Permission = 3 Then varpath = varpath & "Superuser /pwd randjont"
Call Shell(varpath, 3)

End If

End Sub

Database 1 is sourced from and ODBC connection and database 2 is from a local table. They both have the same field (although named slightly different). Where do I put the query/sql that will do the last part of opening the Subject Form for the person with the common field value? Your help is greatly appreciated.
Tyler:)
 

Users who are viewing this thread

Back
Top Bottom