pass a value to an unbound combo box in a different database.

  • Thread starter babyatx13 via AccessMonster.com
  • Start date
B

babyatx13 via AccessMonster.com

I am trying to pass a value to an unbound combo box in a different database.
Example
Working in DB1 I open DB2 and FormA, in FormA I have a unbound combo box
(cboprojectselect ) that looks up the same set of ProNo’s found in DB1. I
want this unbound combo box to show the ProNo that was found in DB1. Can
anyone tell me how this can be done in DB1 code?
Code in DB1:
Private Sub Schedule_Click()
Dim xPath
Dim xTemp
Dim xApp As Application
Dim xProno

Set xApp = CreateObject("Access.Application")

xProno = Me.Projectno
xTemp = “T:\â€
xPath = xTemp & "DB2.accdb"

xApp.OpenCurrentDatabase xPath, , True
xApp.DoCmd.OpenForm "FormA"

End Sub

This works fine I just need the next step.
Where cboprojectselect = xProno
I tried :
Forms!frm_daterangeenter!cboprojectselect = xProno
xApp.DoCmd.OpenForm "FormA", , ,“cboprojectselect = xPronoâ€
xApp.DoCmd.OpenForm "FormA", , ,cboprojectselect = xProno
xApp.DoCmd.OpenForm "FormA",acNormal,,cboprojectselect = xProno
xApp.DoCmd.OpenForm "frm_daterangeenter", acNormal, , cboprojectselect =
xProno, acFormEdit
xApp.DoCmd.OpenForm "frm_daterangeenter", acNormal, , cboprojectselect =
xProno, acFormAdd
And other variations of the above and nothing worked.

Any HELP would be appreciated.
Thanks
K Board
 
D

Dirk Goldgar

babyatx13 via AccessMonster.com said:
I am trying to pass a value to an unbound combo box in a different
database.
Example
Working in DB1 I open DB2 and FormA, in FormA I have a unbound combo box
(cboprojectselect ) that looks up the same set of ProNo’s found in DB1. I
want this unbound combo box to show the ProNo that was found in DB1. Can
anyone tell me how this can be done in DB1 code?
Code in DB1:
Private Sub Schedule_Click()
Dim xPath
Dim xTemp
Dim xApp As Application
Dim xProno

Set xApp = CreateObject("Access.Application")

xProno = Me.Projectno
xTemp = “T:\â€
xPath = xTemp & "DB2.accdb"

xApp.OpenCurrentDatabase xPath, , True
xApp.DoCmd.OpenForm "FormA"

And now (after opening the form in xApp) write:

xApp.Forms!FormA!cboprojectselect = xProno
 
B

babyatx13 via AccessMonster.com

it works
plain as the nose on my face wasn't it.
I had Forms!FormA!cboprojectselect = xProno
just not with the xApp.
thanks a million.

K Board

Dirk said:
I am trying to pass a value to an unbound combo box in a different
database.
[quoted text clipped - 18 lines]
xApp.OpenCurrentDatabase xPath, , True
xApp.DoCmd.OpenForm "FormA"

And now (after opening the form in xApp) write:

xApp.Forms!FormA!cboprojectselect = xProno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top