473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

suppress macro warning msgs when tranferring remote BE tables

tuxalot
200 100+
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
Mar 26 '09 #1
10 5381
DonRayner
489 Expert 256MB
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.

Expand|Select|Wrap|Line Numbers
  1. Docmd.SetWarnings false
  2. Docmd.SetWarnings True
Mar 26 '09 #2
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.
Mar 26 '09 #3
tuxalot
200 100+
Thanks for the quick replies.
Mar 26 '09 #4
tuxalot
200 100+
Not working folks. Still getting the macro warnings (18 in total) when I am linking to my BE. Here's my code:
Expand|Select|Wrap|Line Numbers
  1.     For Each tdf In dbs.TableDefs
  2.         If Left(tdf.Name, 4) <> "MSys" Then
  3.             'turn off macro warnings
  4.             DoCmd.SetWarnings False
  5.             'transfer tables
  6.             DoCmd.TransferDatabase acLink, "Microsoft Access", Trim(strDbPath), acTable, tdf.Name, tdf.Name
  7.             SysCmd acSysCmdSetStatus, "Processing table [" & tdf.Name & "]..."
  8.         End If
  9.     Next tdf
  10.  
Then, before exiting I am turning the warnings back on.

Any ideas??? Warning bmp is attached.
Attached Images
File Type: bmp warning.bmp (24.3 KB, 416 views)
Mar 27 '09 #5
Stewart Ross
2,545 Expert Mod 2GB
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
Mar 27 '09 #6
DonRayner
489 Expert 256MB
I believe all you have to do is to add the server to your trusted zone in Internet Explorer.
Mar 27 '09 #7
ChipR
1,287 Expert 1GB
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.
Mar 27 '09 #8
tuxalot
200 100+
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.
Mar 27 '09 #9
ChipR
1,287 Expert 1GB
Is it better to use TransferDatabase rather than just change the link location? Right now I'm using:

Expand|Select|Wrap|Line Numbers
  1. Function ReLink() As Boolean
  2. ...
  3.     For Each tdf In db.TableDefs
  4.         If Len(tdf.Connect) > 0 Then
  5.             tdf.Connect = ";DATABASE=" & strNewPath
  6.             Err = 0
  7.             On Error Resume Next
  8.             tdf.RefreshLink ' Relink the table.
  9.             If Err <> 0 Then
  10.                 ReLink = False
  11.                 Exit Function
  12.             End If
  13.         End If
  14.     Next tdf
  15. ...
Mar 27 '09 #10
tuxalot
200 100+
Not sure what would be better. this is my code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdUpdatePath_Click()
  2.  
  3.     'much of the below code was found at http://www.dbforums.com/microsoft-access/1005409-how-change-link-path-vba.html
  4.     'if update path button is clicked when the path textbox is empty then exit sub
  5.     If Len(txtChangePathBackEnd & "") = 0 Then GoTo Err_cmdUpdatePath
  6.  
  7.     On Error GoTo ErrTrap
  8.     Dim dbs    As Database
  9.  
  10.     Dim tdf    As TableDef
  11.     Dim strDbPath As String
  12.     Dim stLinkCriteria As String
  13.  
  14.     'delete all linked tables if they exist, but not linked tblReportsState!
  15.     For Each tdf In CurrentDb.TableDefs
  16.         If Left(tdf.Name, 4) <> "MSys" And Left(tdf.Name, 15) <> "tblReportsState" And _
  17.            (tdf.Attributes And dbAttachedTable) = dbAttachedTable Then
  18.             CurrentDb.TableDefs.Delete tdf.Name
  19.         End If
  20.     Next tdf
  21.     Set tdf = Nothing
  22.  
  23.     'update linked location based on user input
  24.     strDbPath = txtChangePathBackEnd
  25.     Set dbs = OpenDatabase(strDbPath)
  26.  
  27.     For Each tdf In dbs.TableDefs
  28.         If Left(tdf.Name, 4) <> "MSys" Then
  29.             DoCmd.TransferDatabase acLink, "Microsoft Access", Trim(strDbPath), acTable, tdf.Name, tdf.Name
  30.             SysCmd acSysCmdSetStatus, "Processing table [" & tdf.Name & "]..."
  31.         End If
  32.     Next tdf
  33.  
  34.     SysCmd acSysCmdClearStatus
  35.  
  36.     Set dbs = Nothing
  37.     Set tdf = Nothing
  38.  
  39.     'success. send message to EU
  40.     MsgBox "Path to back end Database has been updated.", vbOKOnly, "Update Successful"
  41.  
  42.     DoCmd.Close acForm, "frmChangePathToBackEnd", acSaveYes
  43.     DoCmd.OpenForm "frmMain"
  44. ...
  45.  
Mar 27 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

6
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...
9
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. ...
6
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...
4
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...
1
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...
12
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 ...
3
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...
13
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.