Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open database 1 with data from database 2

Status
Not open for further replies.

niteraven

Technical User
Oct 26, 2006
92
US
Hi All

What I want to do is to open a form in database1 from database2 and passing one numeric field into database1 form. I have the form in the database1 opening from database2 with the following code:


Code:
    Dim acc As Access.Application
    Dim db As DAO.Database
    Dim strDbName As String
    Dim rst As DAO.Recordset
    Dim NCnumber As Integer
    
    
    DoCmd.Save
    

    strDbName = ("S:\Compliance Systems\Common Software Tools\Project ECN Database\PROJECT ECN.mdb")
    
    NCnumber = Me.txtNCNum

    Set acc = New Access.Application
    Set db = acc.DBEngine.OpenDatabase(strDbName, False, False)
    acc.OpenCurrentDatabase strDbName
    acc.DoCmd.OpenForm "frmECNOENC", acNormal, , , acFormAdd, acWindowNormal, NCnumber
    
    
    Set appAccess = Nothing
    Set db = Nothing

My question is how or where do I pass the numeric field from database2 to database1? I tried openargs a bunch of different ways and could not get it to work.

Any help is greatly appreciated.

Thanks
Raven
 
For anyone trying to do this, here is what I had wrong
THe code above was in the form in database2, the code I had in form in database1 was wrong. below is the code that worked for me.

Code:
Dim StrNonCno As Integer
    
    StrNonCno = OpenArgs
    
    Me.NonConNo = StrNonCno

Just got frustrated to fast and jumped the gun. Perseverance pays off.

Thanks
Raven
 
Any reason you can't just use linked tables to get around this altogether?

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top