MS Access 2010 Ribbon Not Changing From Report To Form - ms-access

In an application I have two ribbons: a "General" one which is used for all forms, and a reports-specific one for all reports. From a "Reports Manager" style form, a user can select a report and preview it.
When the report opens, it correctly displays the Reports Ribbon. However, when the report is closed, the Reports Manager form is still showing the Reports Ribbon, instead of the general one.
Once this form is closed, the Ribbon changes back to the general one.
Note that users access this application, as an accde, via Terminal Server.
This incorrect behaviour does NOT happen on a local development machine, so I suspect it is due to a TS 'refresh' issue - which I have noticed in a couple of other circumstances.
Is there anyway to 'force' a refresh of the Ribbon when a report is closed, and the Reports Manager form is therefore displayed?

I would consider in your startup code grabbing a handle to the main ribbon (that is not re-displaying). Then in the reports on-close event execute a ribbon invalidate command like this:
MyMainRibbon.Invalidate
So you can “force” a ribbon re-plot. This does suggest you always use a accDE, since with a accDB then any un-handed error will ALSO lose the above global var that holds a reference to the ribbon.

Related

Custom ribbon does not display when database is opened from File menu

A custom ribbon is assigned to an (entire) database in the options for "Current Database" and displays when I open the database with a shortcut like this:
"C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" D:\d\music.accdb
However, if I close the database and re-open it from the File menu, the custom ribbon is no longer displayed.
If I attempt to load the custom ribbon from VBA, I get an error stating it is already loaded. (The "Client Settings" option is set to show add-in user interface errors, as of course the ribbon would otherwise not display when opened using the first method.)
I specifically re-assigned an individual form from its own custom ribbon to the database-wide custom ribbon to see if this would make the ribbon appear, but it did not when I opened the form. (The form's specific custom ribbon appeared okay before the reassignment.)
I'm using Access 16 as part of Office 365
.
Also, the database is listed twice on recently opened files. I have double-checked again and again: the exact same file is listed twice, with two different timestamps, as the last two files opened. Clicking the icon for one opens the database with the custom ribbon displayed; the other does not. If I instead browse and re-open the closed file from the Windows folder, the custom ribbon is not displayed.
Any ideas what would cause this?
dbmitch put me in the right direction. I was able to solve this and also eliminate the duplicate listing for the database on the File: Open: Recent menu by deleting all records in the table USysRibbons, performing a compact & repair, then restoring data to USysRibbons.

SSRS-Datasource won't change when reupload report

I got a report with 2 data sources and both are Shared Data source. I am trying to change both of them to Custom Data Source but when I re-upload the report in my Report Manager, it won't work.
Edit: I don't have an error because the report successfully uploads, but the data source doesn't change. If I have a field in the report, the report shows the new field, but the data source stays the same.
This might be because of caching that SSRS does with the datasource for the report on the server. Do the new datasources have the same name as the old ones?
You could create the custom datasources in the DataSources tab in the Manage menu for the report in the report manager.
To do this open up the Report Menu by click on the "..." then selecting Manage
Then click on the Data Sources Tab, then change the data source to Custom Datasource.
Then set up the datasource like you did in the report, you will need to select SQL Server for the Connection, add the connection string and choose the authentication type which in the image below is windows authentication but I am not sure how it is set up on your server. Then click Test Connection. Then Click Save (make sure you click Save before navigating away).
Or you could delete the old report in the report manager and then upload it again. Note that deleting the report will delete any schedules and other customization you have done ie. Name and Description.
Is there an error message? It won't work could be a bunch of things. I'd upload a picture of the error or whatever screen you can't get past. Let me know when you can do that, then it will be easier to troubleshoot. If you can't upload an image than I would:
Check your datasource connections are correct.
Check your datasets are using the correct connection.
This is a setting thats controlled from the deployment properties of the visual studio SSRS project. Right click the project name and select Properties. Then from the Property section of the general page notice "Overwrite Datasets" & "Overwrite Datasources". Change the one that's necessary and re-deploy to see it updated in the report portal.

change .ribbonname property on open

Context:
I have an Access database application that was built in Access 2k. I have a custom ribbon built that I am playing around with, and I also have some user "security" in this app.
When a report opens, I want to check the username and switch to a different ribbon for specific users. I would think that this code would work:
The Code:
If GetUserName() = "admin" Then
Me.Report.RibbonName = "CustomPrintPreview"
Else
Me.Report.RibbonName = "MSToolbar1"
End If
The Problem:
This code seems to execute (and it's not doing On Error Resume Next). However when the open event ends, the report opens with no data (when there should be data). If I remove this if block, it runs fine aside from setting the correct ribbon. I should mention that if I manually set the RibbonName property for the report, both ribbons work fine, so it is not a problem with the ribbons themselves.
I'm currently using access 2007, but this will be deployed for 2010 versions as well. Does anyone know what's going on here?

Create a standalone form shortcut in Microsoft Access 2013

I currently have a functioning form that searches through my database by calling a query. What I'm trying to do is turn this into a standalone application where I can simply open a file and only the form opens, running the database on the back-end. I have tried running a macro that opens the form, and I have tried creating a shortcut to my desktop, but nothing has worked.
Does anyone have any suggestions? Anything that will only show the form and the search results would be good (desktop shortcut, HTML file, etc.).
Thanks!
You will need to split your database so that the tables are located in a separate back-end file (which can be kept on a server). These instructions apply to Access 2007 and 2010 but the process is very similar for 2013.
Once this is done, your tables will become linked tables (stored in a separate file) and your front-end .addcb file will only contain queries, forms and reports.
You can control which form opens when the application loads through File -> Options -> Current Database. There are also several other useful controls here for limiting what the user can do; ie.
Hiding the list of database
Hiding the tabs (you will therefore need to create buttons to move between forms)
Hiding the Ribbon and/or status bar
Disabling Layout View
It's safest to change these settings on a copy, so you don't inadvertently lock yourself out; however, by holding down shift when opening the file from within Access, most of these options will be bypassed and you will be able to edit the database / revert these settings should you need to.
In terms of making it a "stand-alone application", it is possible to create a copy that will open without requiring the full version of MS Access on the user's PC (instead using Access Runtime).
I always distribute my front-ends as .accde format (File -> Export ACCDE). The benefits are as follows:
Smaller file size
Optimise memory usage / improves performance
VBA code runs but cannot be viewed or edited
I think what you're looking for is here:
http://office.microsoft.com/en-us/access-help/command-line-switches-for-access-HA010166605.aspx
and
http://office.microsoft.com/en-us/access-help/command-function-HA001228801.aspx
Basic idea, create a macro called AutoExec that checks for a command line argument when opening the database. Setup a shortcut with a command line argument (whatever you decide to name it, I'll use 'lookuponly' as the example.) like this:
"C:\Users\%Username%\Desktop\MyDatabase.mdb" /cmd "lookuponly"
when you double click the shortcut it should auto-run the macro and open your lookup form. Of course under newer versions of access you'll have to set the location of the database as a trusted location or access will attempt to block the database.
http://office.microsoft.com/en-us/access-help/decide-whether-to-trust-a-database-HA010256412.aspx

MS Access: Reports referencing other reports

I have several MS Access 2010 Reports that contain controls that reference other controls on other Reports. So, for example, if report1 has a text box called report1_textBox, and this text box gets its value from a text box on report0 called report0_textBox, then I set the Control Source property of report1_textBox to:
= [Reports]![report0]![report0_textBox]
I created a Form that the user can use to select Reports to open, and when the user selects a Report that depends on other Reports, my code opens those Reports before opening the selected Report. This works fine in some instances, but in other instances I get some strange behavior.
Going back to the example above, I encounter situations where even if I open report0, then open report1, the text box report1_textBox displays #Error as if report0 is closed or does not exist. But if I then just click on report0 and change its view then change it back, then go back to report1 and scroll a little, the text box report1_textBox "magically" changes from #Error to the proper value. I tried hitting the "Refresh All" button after opening the reports, and it does not update the text box.
Does anyone know of a way to fix this or at least work around it?
Thank you!
(Adding: Ideally, I do not want to open multiple reports like I'm doing now. If the user wants to view a report, I would like to only open that report, but from what I understand, if the selected report needs data from another report, that other report needs to be open. I can ultimately solve this by writing VBA code to execute queries, but I would like to avoid this, especially since I already have the data I need - it's just on another report. Does anyone know if it is possible to realize this ideal situation? Thanks!)
I would suggest going with VBA code for this.
Your question, actually, contains an answer (partial) - if you need data from another report that report must be opened first. However, the following code might help you somewhat.
You can open report(s) as hidden:
...
DoCmd.OpenReport "report0", acViewReport, , , acHidden
...
But again, I would recommend to write VBA code to pull the data using either existing queries from other reports or create new ones [queries].