Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Form On Open event, except not exactly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rb608 - 28 Jun 2007 19:10 GMT
I have a form with a command button that opens a second form and
populates it with data from the initial form.  That part is fine.
What I want to do is use that data in an On Open event (or something)
that will execute *after* the data is loaded by the first procedure.

Specifically, the second form should display an image based on a path
and filename concatenated from the first form's data :
Forms!PhotoData!imgFrame1.Picture = strImagePath

It all works fine using a command button on the second form; but that
requires loading a default image and a manual click to display the
intended image.  I want the desired strImagePath image to load
automatically when the form opens.

There's a sequence problem, however.  I can't transfer the data to the
second form before opening it (DoCmd.OpenForm "PhotoData"); but I
can't create the strImagePath from that data until after the form is
opened, so I can't create the image path string in an On Open event
procedure.

I know there has to be another way to do this.  Suggestions?  Anybody
want to make me slap my forehead and say, "D'oh!"?

TIA,
Joe
BRC - 28 Jun 2007 19:20 GMT
> I have a form with a command button that opens a second form and
> populates it with data from the initial form.  That part is fine.
[quoted text clipped - 21 lines]
> TIA,
> Joe

I am far from expert, but it seems you could pass the path with
"openargs' method. in what ever statement you are using to open second
form. Hope this helps
Dennis - 28 Jun 2007 20:10 GMT
So create a module, and in it, define some PUBLIC variables in which to store
values during the On Open event. Then, at a point of your choosing, simply
call a private (or public for that matter) sub, and use those variables to
fetch what you need.

> I have a form with a command button that opens a second form and
> populates it with data from the initial form.  That part is fine.
[quoted text clipped - 21 lines]
> TIA,
> Joe
BRC - 28 Jun 2007 21:05 GMT
Sorry about my earlier post, i didn't read your original close enough.
I think what you want to do could be done if you put your code in
form2's activate event. See vb help for details on when it occurrs.
rb608 - 28 Jun 2007 21:58 GMT
> So create a module, and in it, define some PUBLIC variables in which to store
> values during the On Open event. Then, at a point of your choosing, simply
> call a private (or public for that matter) sub, and use those variables to
> fetch what you need.

I sort of took a blunt instriument approach along those same lines.  I
just put a duplicate subroutine in the procedure that opens the form
so that it forces the filename into the control as part of opening the
form.

Tx.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.