If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Passing Variables or Database Parameters to forms and tables...
As our Ministry database gets bigger I need to find a way to story
variables or parameters so that rather than change 15 forms and reports I could change one variiable possibly stored in a table and change the whole database at once by changing that value... for example it took an hour to change the logo on each individual form and report yesterday.. Couldn;t I just store the name and location of the logo possibly in a table... and reference all of the object properties to it... I'm not sure how I would do it and what the syntax would be to retrieve it but it would sure be easier.... Any ideas.. or help Thanks fb |
#2
|
|||
|
|||
Passing Variables or Database Parameters to forms and tables...
The best thing to do is not embed the logo in forms and/or reports, but instead link the image to an
external file location. I have a logo on each report, but I allow the user (in this case a company) to customize the application to their liking by having them place their own logo on each report. What they do is browse to a folder for their logo using the standard windows File/Open browse window. They select the logo file location and the path is saved to a table. Once that is complete, POOF all the reports now show their logo! Sweet. 1. Create a table called tblLogo with the following settings: LogoID (AutoNumber) Long Integer. Set this as the primary key. PathToLogo (Text) Field Size-250 Save and close the table. Open the table in regular mode. Enter the full path to the logo file in the PathToLogo field. (You can automate this with additional code if you desire.) 2. On your report use an Image Control to place the logo in a suitable location From memory I believe you will be prompted for the location. Browse to the location of the logo file. The logo will be embedded for the moment and the path will show in the Properties for the image control. 3. Right click on the image control and go to Properties. Change the following: - Change the name to imgLogo - Delete all the path information on the Picture line. A message will come up saying "Do you want to remove the background?" Say Yes to this box and the logo disappears. The Picture line should now say (none). - Change Picture Type to "Linked" - In the Size Mode enter "Zoom". That is my preference, but you can choose another. Zoom displays the entire object, resizing it as necessary without distorting the proportions of the object. - Set Picture Alignment to "Center" 4. In the Report's Open event put this code in: Private Sub Report_Open(Cancel As Integer) On Error GoTo ErrorPoint If IsNull(DLookup("[PathToLogo]", "tblLogo")) Then Me.imgLogo.Picture = "" Else Me.imgLogo.Picture = DLookup("[PathToLogo]", "tblLogo") End If ExitPoint: Exit Sub ErrorPoint: If Err.Number = 2220 Or Err.Number = 2114 Then Else MsgBox "The following error has occurred:" _ & vbNewLine & "Error Number: " & Err.Number _ & vbNewLine & "Error Description: " & Err.Description _ , vbExclamation, "Unexpected Error" End If Resume ExitPoint End Sub 5. Compile the code, save and close the report. Open the report and the logo should now appear. If the path is incorrect you will see nothing, but no error messages either. 6. Just copy this image control onto all your reports and add in the necessary code. This way one change to the location of the logo file will instantly make all reports show the new logo. Nice. -- Jeff Conrad Access Junkie Bend, Oregon "R Schlageter" wrote in message m... As our Ministry database gets bigger I need to find a way to story variables or parameters so that rather than change 15 forms and reports I could change one variiable possibly stored in a table and change the whole database at once by changing that value... for example it took an hour to change the logo on each individual form and report yesterday.. Couldn;t I just store the name and location of the logo possibly in a table... and reference all of the object properties to it... I'm not sure how I would do it and what the syntax would be to retrieve it but it would sure be easier.... Any ideas.. or help Thanks fb |
Thread Tools | |
Display Modes | |
|
|