I have a client that doesn't actually have Access, so they use the Access Runtime 2016 to use my program. In the runtime version there is no ribbon, but mostly they manage without.
There is only one issue, there is a continuous form that the user needs to be able to sort ascending or descending. In the full version of Access, there's a convenient little button to take care of that.
I found a solution here, but it doesn't work when I try it. I'm assuming that it's because my client is using Runtime 2016. There is also a question that addresses this for Access 2003, but there's no way (as far as I know) to make buttons for Access 2007 runtime and later.
What is the recommended method to provide sorting (and filtering) for Access 2016 runtime?
Personally I never let my customers use the Access UI for sorting or anything else, I bind the double click event of the header in any sortable column to code that uses the OrderBy and OrderByOn properties of the form to set the sorting up using VBA.
Here is sample code:
Private Sub s_Description_DblClick(Cancel As Integer)
If Me.OrderBy = "Description" Then
Me.OrderBy = "Description DESC"
Else
Me.OrderBy = "Description"
End If
Me.Requery
End Sub
Related
I am using two different Access applications to perform some tasks. On both of them, I 've stored a Lable with a text of the current Version of the application-Access. For example:
Access_1.Forms("2").Lable_1 = "Version 1.010"
Access_2.Forms("2").Lable_2 = "Version 1.029"
Each version of Access_1 is compatible with a specific version of Access_2, thus I need to inform the user whether his set of Access is compatible with each other or not. So I am trying to find a way to perform a control check whenever the user opens Access_1 like:
If Access_2.Forms("2").Lable_2.Value<>"Version 1.029" then
msgbox "Your application is not compatible with Access2"
End if
A label has no Value property, only the Caption:
If Access_2.Forms("2").Lable_2.Caption <> "Version 1.029" Then
MsgBox "Your application is not compatible with Access2"
End if
I'm developing a multi-user application with access as a front-end, using a custom ribbon to retrieve functionalities. I'm an intermediate VBA developer, but with little experience on XML ribbons.
Well, the scenario: I have a table that relates users with forms to define permissions, when my Users Log In, I run through that table and write an array with the permissions for the current user. All my ribbon buttons have the GetVisible="GetVisibleCallback", so when the ribbon gets invalidated, the callback checks against the array to hide/unhide the buttons, with the code:
Public Sub GetVisibleCallback(control As IRibbonControl, ByRef visible As Variant)
If IsEmpty(arrayPermissoes) Then
visible = False
Else
If UBound(Filter(arrayPermissoes, control.Tag)) > -1 Then
visible = True
Else
visible = False
End If
End If
End Sub
This is working flawleslly, but the problem is: I have multiple tabs on the custom ribbon, and some users has no permission for any form on a determined tab eg.: "Register Tabs", when the Ribbon gets invalidated, the users can see the tab, but it has no Buttons in it. What I would like to achieve is: If there is no visible button on a determined tab, make it invisible too, how can I achieve this?
Sorry for the Bad English! I'm working on it!
The tab control provides the getVisible callback. So, you can check whether a user is allowed to see it or not. Also you may consider calling the Invalidate method of the IRibbonUI interface which allows to invalidate the cached values for all of the controls of the Ribbon user interface.
You can customize the Ribbon UI by using callback procedures. For each of the callbacks implemented, the responses are cached. For example, if a solution writer implements the getImage callback procedure for a button, the function is called once, the image loads, and then if the image needs to be updated, the cached image is used instead of recalling the procedure. This process remains in-place until the code signals that the cached values are invalid by using the Invalidate method, at which time, the callback procedure is again called and the return response is cached.
<customUI … OnLoad="MyAddinInitialize" …>
…
Dim MyRibbon As IRibbonUI
Sub MyAddInInitialize(Ribbon As IRibbonUI)
Set MyRibbon = Ribbon
End Sub
Sub myFunction()
MyRibbon.Invalidate() ' Invalidates the caches of all of this add-in's controls
End Sub
Read more about the Fluent UI (aka Ribbon UI) in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
I am trying to create a data driven subscription for a report that uses #UserID to filter the results (for security purposes). The solution I've seen referenced as the answer to several similar questions is a broken link.
We'd like to have a version that a user can access online as well as the subscription report that is emailed. Is there any way to do this without having two versions of the report (one with userID and one without)?
We have developed a solution that allows the same report to be used for live access as well as data-driven subscriptions (DDS). It is based on the concept found at the link provided by djphatic
To start, we return the #User value using custom code added to the report, instead of the User!UserID function which will make the DDS choke. The code is similar to the Prologika solution, but I found it at another online source--my apologies for not remembering where I found it. The code is:
Public Function GetHashedUser()
Try
Return Report.User!UserID
Catch
Return " "
End Try
End Function
For the user parameter default value we use:
=Code.GetHashedUser()
This returns the User!UserID if the report is being run live.
The data-driven subscription needs to have the user and other parameters passed using the query for the subscription. Since any parameters passed this way will be visible in the URL, we use a hashed version of the userID (called the userkey). The userkey corresponds to a value in our security table and can identify the user and their associated permissions. We don't encrypt the other filters, since they are based on the user and are used for drill-downs.
Please see the link below. I've not tested this myself but I've seen this solution mentioned before.
http://prologika.com/CS/blogs/blog/archive/2011/03/28/data-driven-subscriptions-and-row-level-security.aspx
So our corporate IT dept has determined that it is time to force SP1 on everyone's PC's.
Which means I need to get my Access 2003 ADE application working with the stupid ADO incompatibility problem.
I got the ADO portion to work by following KB2517589, but now several of my textboxes say #Name?.
These are bound to code, so, for example, the data field in the textbox is =CalcShippingAddr().
As a test, I replaced the code with the following:
Public Function CalcShippingAddr() As String
msgbox "Func Called"
CalcShippingAddr = "Test"
End Function
This works fine on my dev machine, but as soon as I make an ADE and send it to a PC without SP1, I get #Name? on the textbox. The msgbox nevers pops up.
Any ideas what might be happening?
This is a fault to do with the field calculation, I haven't seen it myself but have heard that clicking in to the relevant text box would then show the value although this is not a solution. I would always recommend using unbound forms as you can control step by step what your fields/objects are doing. As you already have a custom function to calculate the shipping address then it should be simple enough for you to add the code the the forms 'Open' or 'Load' event e.g.
Private Sub Form_Load()
textbox = CalcShippingAddr
End Sub
I have a need to determine what security group(s) a user is a member of from within a SQL Server Reporting Services report. Access to the report will be driven by membership to one of two groups: 'report_name_summary' and 'report_name_detail'. Once the user is executing the report, we want to be able to use their membership (or lack of membership) in the 'report_name_detail' group to determine whether or not a "drill down" should be allowed.
I don't know of any way out of the box to access the current user's AD security group membership, but am open to any suggestions for being able to access this info from within the report.
You can add custom code to a report. This link has some examples.
Theoretically, you should be able to write some code like this, and then use the return value to show/hide what you want. You may have permissions problems with this method, though.
Public Function ShouldReportBeHidden() As Boolean
Dim Principal As New System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent())
If (Principal.IsInRole("MyADGroup")) Then
Return False
Else
Return True
End If
End Function
Alternatively, you could add your detail report as a subreport of your summary report. Then you could use the security functionality built in to SSRS to restrict access to your sub report.
In Reporting Services just use :
Public Function IsMemberOfGroup() As Boolean
If System.Threading.Thread.CurrentPrincipal.IsInRole("MyADGroup") Then
Return True
Else
Return False
End If
End Function
as indicated in this posting
Note: This works once the report is deployed to server but not in the IDE.