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 / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Using a variable with the bang operator?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cseifferly - 04 Nov 2006 02:27 GMT
How would I rework this code so that I can use variables with it?

DoCmd.OpenForm "frmReportsMenu", acDesign
Forms!frmReportsMenu.cmdClose.Picture = "I:\Bid Administration\bids.ico"
DoCmd.Close acForm, "frmReportsMenu", acSaveYes

I'd like to create a loop to open all of the forms I have specified in a
table.  

Crystal
tina - 04 Nov 2006 06:46 GMT
assuming your table of form names is called tblForms, and the field holding
the form names is called FormName, try something along the following lines,
as

   Dim rst As DAO.Recordset, str As String

   Set rst = CurrentDb.OpenRecordset("tblForms", dbOpenDynaset)
   rst.MoveFirst

   Do
       str = rst("FormName")
       DoCmd.OpenForm str, acDesign
       Forms(str).cmdClose.Picture = "I:\Bid Administration\bids.ico"
       DoCmd.Close acForm, str, acSaveYes
       rst.MoveNext
   Loop Until rst.EOF

   rst.Close
   Set rst = Nothing

hth

> How would I rework this code so that I can use variables with it?
>
[quoted text clipped - 6 lines]
>
> Crystal
 
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.