The best solution is obviously to use Windows security.
If that is not suitable, here is a possible alternative trick, exploiting the fact that Access remembers all opened connections until Access is closed:
- copy the connect string of one of your tables
- create a passthru queries "ptqConnect" and enter any fast SQL statement in it, like
- paste the connect string of into the PTQ Connect property, and make sure you add the
PWD=something; in it.
- in the startup procedure of your app make sure you call that PTQ. Something like
DCount("*", "ptqConnect") will do.
That's it. Since Access remembers opened connections until you close it, even if you close the db, your other tables will now open without any fuss, even if no password is stored in the linked tables Connect string.
If you don't want to expose the connection string that includes the PWD, you could as well initiate a connection from VBA and hide the code by delivering a MDE or just password protecting the code.
From here: http://stackoverflow.com/questions/9093266/save-password-for-odbc-connection-to-ms-sql-server-from-ms-access-2007
Private Sub cmdRefreshAllRecords_Click()
Dim strGuidID As String
Dim rst As DAO.Recordset
' This is NOT how to get the GUID
' The result will be "????????"
strGuidID = Me.ID
' This will get the GUID. StringFromGUID is a built in MS Access function
strGuidID = StringFromGUID(Me.ID)
' You can also get the GUID from the actual Records Field
strGuidID = Me.Recordset.Fields("ID")
Set rst = Me.RecordsetClone
If rst.RecordCount > 0 Then
' Here we must convert the ID field using the StringFromGUID field.
' ID is the name of the field in the Recordset/Underlaying Form
rst.FindFirst "StringFromGUID(ID) = " & strGuidID
Me.Bookmark = rst.Bookmark
Set rst = Nothing
CREATE TABLE #counts ( table_name varchar(255), row_count int )
EXEC sp_MSForEachTable @command1='INSERT #counts (table_name, row_count) SELECT ''?'', COUNT(*) FROM ?'
SELECT table_name, row_count FROM #counts ORDER BY table_name, row_count DESC
I deployed a SharePoint feature that has an Event Receiver and ran into this error when trying to update the Today Column during a nightly batch run. The Error occured on random Document Libray items. So I did some research and found out that I needed to update the Event Receiver to run as Synchonous when Updating items. This solved the problem! By default Event Receivers run Asynchrounsly, which is not always ideal, especially in this situation.
To fix this problem just update the Element.xml file for the Event Receiver in question for the event type (Updating) you want to run as Synchronous as follows. Then redeploy. Be sure to Deactivate and Activate the site feature once it has been redeployed since it might not be used everywhere.
<Synchronization>Synchronous</Synchronization> under Elements -> Receivers -> Receiver tag
Also in my nightly batch job I used the following code to disable Events when Updating... The Using Code is further down the page.
//Disables Events when updating
using (var scope = new DisabledItemEventsScope())
SPList list = oWebsite.Lists["Code Rules"];
//This must be switched on, otherwise the Update method will throw an exception.
collWebsite[i].AllowUnsafeUpdates = true;
for (int k = list.Items.Count - 1; k >= 0; k--)
SPListItem item = list.Items[k];
//This only Works if the List Item was manually Updated before using a column called Today.
item.Properties["Today"] = DateTime.Now.Date.ToString(CultureInfo.InvariantCulture);
//SystemUpdate Updates without changing the Modified Time OR Modified By and DOES NOT make a New Version!
collWebsite[i].AllowUnsafeUpdates = false;
/// Disabled item events scope
/// <see cref="https://adrianhenke.wordpress.com/2010/01/29/disable-item-events-firing-during-item-update/"/>
class DisabledItemEventsScope : SPItemEventReceiver, IDisposable
this.oldValue = base.EventFiringEnabled;
base.EventFiringEnabled = false;
#region IDisposable Members
public void Dispose()
base.EventFiringEnabled = oldValue;
1. Run regedit
2. Go to HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common (repeat for muliple versions of MS Office)
3. Create a KEY called "Security" here by right clicking on the Common key and selecting New->Key and typing "Security"
4. Create a DWORD in the Security key by right clicking on Security, selecting New->DWORD and type in "DisableHyperlinkWarning"
5. Change the value of this DWORD to 1
Someone created a VM for me recently and everyime I launched IE to get to our SharePoint site internally I was being prompted to login. So I changed the IE Setting to use my credentials to log in automatically. That was OK for the time I was on the VM. BUT, when I went back in it asked me again and my settings in IE had been reverted.
This was so annoying that I Googled it and found out that it was the IE Enhanced Security Configuration that was causing this problem. So I switched it off and not it doesn't prompt me any more :-)
You write some LINQ code to update your SQL tables like this below BUT it does not throw an exception and it does not Update the tables!
using (var db=new SomeDatabaseContext())
The reason why is because your Table does not have a Primary Key! You can update your DBML designer to have that Primary Key and you don't need to touch the actual SQL Server tables for this to work!
Best of Luck.
WITH q AS
SELECT TOP 1 *
/* You may want to add ORDER BY here */
DELETE TOP (1)
will also work, but, as stated in the documentation:
The rows referenced in the TOP expression used with INSERT, UPDATE, or DELETE are not arranged in any order.
Therefore, it's better to use
WITH and an
ORDER BY clause, which will let you specify more exactly which row you consider to be the first.