Windows 7 SP1 breaks access (not the ADO way) - ms-access

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

Related

Hiding Ribbon Tab when no visible button on it

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)

MS Access not working for multi user

I have a DB I created as a sort of real time virtual client check in log. It would be stored on an intranet network drive. In theory, a greeter can send client information back to be picked up by another worker. This is done through a series of forms, tables, and queries. When I test it myself on my own machine, opening both the greeter and reception forms I can enter information on the greeter, click the action button to send it to the table, where a timered query(held in a hidden form opened with an AutoExec macro) picks up the current record, and then displays it on the reception form. Everything works perfectly. The only problem is, when I try to test it on multiple computers, the greeter can send info back, it appears on the table, but the reception form never populates. Any ideas where the disconnect might be?
edit I have decided I want to do away with the hidden initialize form, so I've re-organized the code as follows. It still works when I do it myself on one computer, but opening the reception form on another computer it still fails to populate.
Reception 1
Private Sub Form_Timer()
If gClientID > gNextClientID Then
gblnRNC = True
Else: gblnRNC = False
End If
If gblnRNC = True And gblnRec1Free = True Then
gRec1CL = gNextClientID
MsgBox "There is a new client to be seen.", vbSystemModal, "New Client Warning"
Me.RecordSource = "RecClientIDNum"
End If
End Sub
So forgive my noob question, I sorta jumped into programming procedures without fully understanding how Access works. I declared global variables but didn't realize they were only global within the scope of the local session running on a particular machine.
Moved the variables that establish the interactions between the various forms to a table and everything works perfectly.

Sorting continuous form in Access Runtime

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

After acDialog form made not visible ms Access eventually throws error when exiting

I've got a search results form in my Access client which uses the trick of being a form opened in acDialog mode. If the user cancels the search the form closes itself, if the user selects one of the search items, the form writes the result into an unbound field and then makes itself not visible.
The calling code will suspend (because of the acDialog mode) until either of the two events described in the previous paragraph happen. The calling code checks to see if the form is still loaded - when it knows a search item has been requested, so it retrieves the item from the form and then closes it. If the form was already not loaded, we assume the cancel route was chosen.
the search results datasource is a select statement "SELECT * FROM details ORDER BY ..."
This trick has worked for a while in the code where "details" is a linked table to another Access database
I am porting to SQL Server, and the details table is now dynamically linked at startup to the correct SQL Server instance. Using the following connection string
ODBC;driver=SQL Server;SERVER=ROO\SQLEXPRESS;DATABASE=Test_DB;UID=my_app;PWD=xxxx;
(Passwords etc changed to protect the innocent)
When Access exits the application (AND ONLY THEN) - if the path through the code has resulted in using the visible = false trick then it exits with an error message. There is no error message if there is an application exit where the path has been through the search form but the form closed itself before returning.
The error message is:
Cannot access database because of Error [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified
and will now Exit.
I need to find out precisely why this is happening and stop it.
I solved the problem with a work around. I created a global variable for the form result and then always closed the search result form itself. The underlying routine that was trying to pick up the result just uses the global variable.
This proved that making a Dialog box invisible to retrieve results is not reliable - the problem disappeared as soon as I changed it.

Execution 'iwy2vpzo52pmp555ftfn4455' cannot be found (rsExecutionNotFound)

Some users get the following error when running reports.
• Execution 'iwy2vpzo52pmp555ftfn4455' cannot be found (rsExecutionNotFound)
They run fine in the morning.
Any suggestions?
Thank you
I can help.
The problem is that the ReportViewer control uses Session to store the currently executing report. Once you navigate away from the reports, the item still remains and eventually loses its "execution context", which is the way Report Server caches reports.
Therefore, before browsing a report, you should attempt to clear out the Session of these reports, so that there are NO cached reports in the Session, and the ReportViewer control can work properly.
You will also find that sometimes when accessing Session.Keys.Count, this error can occur, as again, the execution context has failed.
Make sure you do this on the page showing the report!!
The 2 options are:
if (!IsPostBack)
{
HttpContext.Current.Session.Clear();
ReportViewer1.ServerReport.ReportServerUrl = new Uri(ReportServerUrl, System.UriKind.Absolute);
ReportViewer1.ServerReport.ReportPath = ReportPath;
System.Collections.Generic.List<ReportParameter> parameters = new System.Collections.Generic.List<ReportParameter>();
....
ReportViewer1.ServerReport.SetParameters(parameters);
ReportViewer1.ServerReport.Refresh();
}
Or
for (int i = 0; i < HttpContext.Current.Session.Keys.Count; )
{
if (HttpContext.Current.Session[i].ToString() == "Microsoft.Reporting.WebForms.ReportHierarchy")
HttpContext.Current.Session.RemoveAt(i);
else
i++;
}
I am using SSRS 2017 and was running into this issue when trying to load a report into my MVC project using URL Access. The issue for me had to do with session.
To check this for yourself, you can try deleting the RSExecutionSession cookie and reload your report. Unfortunately, this is only a temporarily fix.
If this does work, try adding rs:ClearSession=true to your query string.
You can read about this setting here.
Look for a trailing space on the report path. This was the cause for me.
On the web.config's impersonation, use identity
impersonate="true"
userName="xxxxx"
password="xxxxx"
instead of : !--<identity impersonate="true"
Hope it helps
If you're running SQL Server Express edition, the SQL Server Agent isn't running to clean up your old SSRS sessions. You'll need to run a job on SSRS DB to clean up the old sessions.
My report took 10 seconds to run and 2 seconds to export - so it wasn't to do with the session expiry length.
I'd get the error when exporting a report to excel into my app an hour after I exported the report.
This error was causing my application to display a run time error.
I added this to the Global.asax class to resolve the error. Tried Server.Clear but got nothing. Session.Clear got rid of the error completely.
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
If ex.InnerException IsNot Nothing Then
If ex.InnerException.ToString.Contains("The report execution") AndAlso
ex.InnerException.ToString.Contains("rsExecutionNotFound") Then
Session.Clear()
Return
End If
End If
End Sub
While it may not be 100% applicable to the question above, I haven't been able to find any other resolution.