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 / December 2005

Tip: Looking for answers? Try searching our database.

Form_Open Event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MChrist - 21 Dec 2005 12:58 GMT
I have a form that uses criteria from another form (fProspects) as part of
the SQL for it's record source.  I've added the following code to Cancel the
form from opening if fProspects isn't open, but it still prompts for the
fields in fProspects before closing the form.

Any ideas how I can get it to Cancel the open before trying to create the
data connection?

Private Sub Form_Open(Cancel As Integer)

 'close if the Prospects form is not loaded
 If CurrentProject.AllForms("fProspects").IsLoaded = False Then
 
   Cancel = True
   
 End If
 
End Sub
stefan hoffmann - 21 Dec 2005 13:41 GMT
hi,

> Any ideas how I can get it to Cancel the open before trying to create the
> data connection?
Use a unbound form and set the record source in the code.

> Private Sub Form_Open(Cancel As Integer)
>   'close if the Prospects form is not loaded
>   If CurrentProject.AllForms("fProspects").IsLoaded = False Then
>     Cancel = True
     Else
     me.RecordSource = "SELET * FROM ... WHERE ID = " & fProspects![ID]
>   End If
> End Sub

mfG
--> stefan <--
Rick Brandt - 21 Dec 2005 13:42 GMT
> I have a form that uses criteria from another form (fProspects) as
> part of the SQL for it's record source.  I've added the following
[quoted text clipped - 14 lines]
>
> End Sub

In design view of the form remove the RecordSource. In your Open code set
the RecordSource when the other form is open.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

 
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.