How to change control on a form from another database?

GBalcom

Much to learn!
Local time
Today, 07:44
Joined
Jun 7, 2012
Messages
460
Hello,
I have a database that I view certain data with (hereby dubbed Access App 1). I have another database that is basically a bridge for information(Access App 2); it sucks information out of software A (not Access), and prepares it for import into software B (Not Access). I've considered merging my two access applications, but It may be easier to have a button in Access App1, that would open Access App2 to the same record.

The form that I need to open in Access App2 is Unbound, and will likely be open already. The only thing I really need to do is update a combo box control on this form to the correct RecordID, Then I'm thinking the code from the OnClick Event of that combo box will do the rest....

So, how hard would this be?
 
Use commandline arguments to open Access App2 and fill the information you need into the control.

HTH:D
 
Sorry Gus,
but, I don't understand. Can you be more specific?
 
I've found this code, but not sure how to extend it to changing the combo box control as well. I'm beginning to think that this code must open the other database to have control over it.

Code:
> Public Sub OpenForeignForm()
> Dim appAccess As Access.Application
> Set appAccess = CreateObject("Access.Application")
> appAccess.OpenCurrentDatabase "C:\MyPath\DataBaseName.mdb"
> appAccess.DoCmd.OpenForm "FormName"
> Set appAccess = Nothing
> End Sub
 
The only thing I really need to do is update a combo box control on this form to the correct RecordID

do you mean to set the Default value of your combobox to the one you will supply?
if so why not create a table in App1 and put the value in that table.
then on App2, create a link to this table from App1.

now on App2's form, load event, set the default value of your combo.

private sub form_load()
me.combo = nz(dlookup("field", "linked_table"), me.combo.itemdata(0))
end sub
 
Hi Arnel,
I'm actually getting the right value to show up in the combo box now, but I can't figure out how to run the code associated with that combo boxes "OnClick" Event.
 
make the Click event of your combobox Public.

and on your App1 code:

Public Sub OpenForeignForm()
Dim appAccess As Access.Application
Dim f As Access.Form
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\MyPath\DataBaseName.mdb"
appAccess.DoCmd.OpenForm "FormName"

set f = appAccess.Forms("FormName")
' call click event
f.yourCombo_Click

Set appAccess = Nothing
End Sub
 
I was able to get this to work. I ran a requery on the form, and that did the trick. Arnel, thanks for getting back to me, I'm sure that would have worked as well.
 

Users who are viewing this thread

Back
Top Bottom