When changing paths to a BE db located on a network via DoCmd.TransferDatabase is there a way to suppress the macro warning messages that appear? I have 14 tables, and 14 warning messages appear in succession one for EACH transfer.
Thanks as always :)
Tux
10 5381
You can disable / enable warning with the following. Just make sure that you re-enable warnings in your code after you finish with the transferdatabase. - Docmd.SetWarnings false
-
Docmd.SetWarnings True
NeoPa 32,556
Expert Mod 16PB
This is relatively safe as it only disables warning messages and not the more serious error messages. Still important to return to default state afterwards of course, but no need to worry that you may miss bugs in your code with this set.
Thanks for the quick replies.
Not working folks. Still getting the macro warnings (18 in total) when I am linking to my BE. Here's my code: - For Each tdf In dbs.TableDefs
-
If Left(tdf.Name, 4) <> "MSys" Then
-
'turn off macro warnings
-
DoCmd.SetWarnings False
-
'transfer tables
-
DoCmd.TransferDatabase acLink, "Microsoft Access", Trim(strDbPath), acTable, tdf.Name, tdf.Name
-
SysCmd acSysCmdSetStatus, "Processing table [" & tdf.Name & "]..."
-
End If
-
Next tdf
-
Then, before exiting I am turning the warnings back on.
Any ideas??? Warning bmp is attached.
Ahh, the message you show is nothing at all to do with Access's internal user warnings. The user warnings are the ones which say things like 'you are about to update 100 rows in table xxxx - are you sure?'.
The security warning you are receiving is one from the OS itself, not from Access. I don't know how to disable these - but they have nothing to do with the SetWarnings settings in Access at all.
-Stewart
I believe all you have to do is to add the server to your trusted zone in Internet Explorer.
I had instructions for my users to add the file locations to Access trusted locations, so here they are:
· Open Access 2007 and select Access Options from the Office Button menu.
· In the Access Options dialog, select Trust Center on the left and click Trust Center Settings…
· In the Trust Center dialog, select Trusted Locations on the left and check Allow Trusted Locations on my network.
· Click Add new location… and type or browse to the location of the application.
· Check Subfolders of this location are also trusted.
· Click OK.
Thanks all,
Sure, I could provide instructions to my users on how to add the path as a trusted location per Chip's instructions if the BE were known and static. Problem is I've no idea where the end user will want to store the BE so I've given them the option to move it. So consider this scenario: A user wants to store their BE on a network share. While the db is closed, they move their BE. During start up, code in my start-up form checks if the BE path is valid and if not, presents a form to allow the user to change the BE path. This bit is now working except the user must accept a host (18 in total) warning messages (one for each linked table) if the BE is not in a trusted path.
Keep in mind this is an A07 runtime deployment so their is no way for a user to get into the trust center to change paths.
I am learning that the following solution may be possible. Take the new BE path selected by the user and convert it to UNC. Then save the UNC path as a trusted location by adding it to the registry. Then link the BE using DoCmd.TransferDatabase and the warnings should not appear. Does this sound like a logical approach?
Possible issue here: WHAMMY
Looks like if the EU selects an updated BE path on their server, it may not transfer at all using Transferdatabase. I cannot test this as I'm developing in a non-server environment.
Is it better to use TransferDatabase rather than just change the link location? Right now I'm using: - Function ReLink() As Boolean
-
...
-
For Each tdf In db.TableDefs
-
If Len(tdf.Connect) > 0 Then
-
tdf.Connect = ";DATABASE=" & strNewPath
-
Err = 0
-
On Error Resume Next
-
tdf.RefreshLink ' Relink the table.
-
If Err <> 0 Then
-
ReLink = False
-
Exit Function
-
End If
-
End If
-
Next tdf
-
...
Not sure what would be better. this is my code: -
Private Sub cmdUpdatePath_Click()
-
-
'much of the below code was found at http://www.dbforums.com/microsoft-access/1005409-how-change-link-path-vba.html
-
'if update path button is clicked when the path textbox is empty then exit sub
-
If Len(txtChangePathBackEnd & "") = 0 Then GoTo Err_cmdUpdatePath
-
-
On Error GoTo ErrTrap
-
Dim dbs As Database
-
-
Dim tdf As TableDef
-
Dim strDbPath As String
-
Dim stLinkCriteria As String
-
-
'delete all linked tables if they exist, but not linked tblReportsState!
-
For Each tdf In CurrentDb.TableDefs
-
If Left(tdf.Name, 4) <> "MSys" And Left(tdf.Name, 15) <> "tblReportsState" And _
-
(tdf.Attributes And dbAttachedTable) = dbAttachedTable Then
-
CurrentDb.TableDefs.Delete tdf.Name
-
End If
-
Next tdf
-
Set tdf = Nothing
-
-
'update linked location based on user input
-
strDbPath = txtChangePathBackEnd
-
Set dbs = OpenDatabase(strDbPath)
-
-
For Each tdf In dbs.TableDefs
-
If Left(tdf.Name, 4) <> "MSys" Then
-
DoCmd.TransferDatabase acLink, "Microsoft Access", Trim(strDbPath), acTable, tdf.Name, tdf.Name
-
SysCmd acSysCmdSetStatus, "Processing table [" & tdf.Name & "]..."
-
End If
-
Next tdf
-
-
SysCmd acSysCmdClearStatus
-
-
Set dbs = Nothing
-
Set tdf = Nothing
-
-
'success. send message to EU
-
MsgBox "Path to back end Database has been updated.", vbOKOnly, "Update Successful"
-
-
DoCmd.Close acForm, "frmChangePathToBackEnd", acSaveYes
-
DoCmd.OpenForm "frmMain"
-
...
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Krishna Srinivasan |
last post by:
I have a form with check boxes. When accessing a check box element
that is not checked, I get a notice (Notice: Undefined variable..). Is
there a way to hide these notices and warning in PHP code...
|
by: Doug Ly |
last post by:
Hi,
When I run this query using WinSQL to connect to a DB2 database, it gave me
the warning:
Error: SQLSTATE 01003: Null values were eliminated from the argument of a
column function.
...
|
by: Kim Hellan |
last post by:
I want to suppress the following warning when compiling.
warning CS0169: The private field 'myvar' is never used
In C++ you would do something like (not sure of the syntax):
#pragma nowarn:0169...
|
by: J Swift |
last post by:
I posted this question earlier but on the wrong usenet.
I have a warning below that I need to suppress
*warning C4018: '<' : signed/unsigned mismatch
I searched google, Microsoft help and MSDN...
|
by: Chris Stankevitz |
last post by:
My .vcproj references an environment variable that no longer exists:
Creating library...
Project : warning PRJ0018 : The following environment variables were not
found: $(WXWIN)
How do I...
|
by: Laurent Deniau |
last post by:
I was playing a bit with the preprocessor of gcc (4.1.1). The following
macros expand to:
#define A(...) __VA_ARGS__
#define B(x,...) __VA_ARGS__
A() -nothing, *no warning*
A(x) -x
...
|
by: Chris Shenton |
last post by:
I am setting up handlers to log DEBUG and above to a rotating file and
ERROR and above to console. But if any of my code calls a logger
(e.g., logging.error("foo")) before I setup my handlers, the...
|
by: Rex Mottram |
last post by:
I'm using an API which does a lot of callbacks. In classic callback
style, each routine provides a void * pointer to carry user-defined
data. Sometimes, however, the user-defined pointer is not...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |