473,396 Members | 1,834 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,396 software developers and data experts.

Trying to re-link hidden tables and keep them hidden - but not TOO hidden!

I'm almost done with an application, and trying to lock it down
tightly. But I still want users to be able to point to a new location
for the data file.

The code below fires off to detect and address the problem of a
moved/renamed data file. The problem: WITHOUT the "tdf.Attributes =
dbHiddenObject" line, my previously hidden tables are now visible.
(Not that the users will normally have the chance to see them, hidden
or not.)

WITH the "tdf.Attributes = dbHiddenObject" code, the tables are
bloody well hidden! Can't see them even if "show hidden objects"
is on.

Any ideas? If so, please be specific about how to deal with
Attributes. They are still a bit mysterious to me.

P. Emigh

--------------------------------------------

Public Function fOpenMain()

Dim dbs As Database
Dim tdf As TableDef
Dim strPath As String

On Error Resume Next

DoCmd.OpenForm "fmnuSwitchboard"

If Err = 3043 Or Err = 3024 Or Err = 3044 Then
If MsgBox("Data file note found, likely because it was moved or
renamed. Would you like to re-link data?" & vbCrLf & vbCrLf & "CAUTION:
Failing to do this correctly could cause data corruption!" & vbCrLf &
vbCrLf & "If you choose NO, you'll have another chance to link to the
data file next time you open the database.", vbYesNo) = vbYes Then

Err = 0

strPath = InputBox("Path and name of data file:" & vbCrLf &
vbCrLf & "Your response might look something like
'\\MainComputerName\CashSheet\CashSheetData.mdb'")

Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
' Re-set links to all the linked tables
If tdf.connect <"" Then
tdf.connect = ";DATABASE=" & strPath
tdf.RefreshLink
End If
tdf.Attributes = dbHiddenObject
Next tdf

dbs.Close

If Err = 0 Then
MsgBox "Links created successfully. The database will
close now. Re-open it, and then you should be able to proceed with
your work."
Application.Quit
Else
MsgBox "There was apparently an error in trying to link
to the server data at " & vbCrLf & strPath & vbCrLf & "Error: " & Err &
" " & Err.Description

End If

Else

MsgBox "The database will close now."
Application.Quit

End If

End If
If Err <0 Then
MsgBox Err & " " & Err.Description
DoCmd.OpenForm "fpopPW"
End If

End Function

Oct 20 '06 #1
1 2167
"pemigh" <pe****@gmail.comwrote in
news:11**********************@f16g2000cwb.googlegr oups.com:
The code below fires off to detect and address the problem of a
moved/renamed data file. The problem: WITHOUT the "tdf.Attributes
= dbHiddenObject" line, my previously hidden tables are now
visible. (Not that the users will normally have the chance to see
them, hidden or not.)

WITH the "tdf.Attributes = dbHiddenObject" code, the tables are
bloody well hidden! Can't see them even if "show hidden objects"
is on.

Any ideas? If so, please be specific about how to deal with
Attributes. They are still a bit mysterious to me.
What do you want? Hidden tables that don't show up to anyone or
hidden tables that don't show up if you have the options set to show
hidden objects?

I don't see why you're worrying about it. I've never hidden tables,
ever -- can't see the point. If the users shouldn't be able to see
them, then, they should be locked out of the database window.

Also keep in mind that hidden tables are not shown in the list of
tables in the QBE if you have SHOW HIDDEN OBJECTS turned off, so
that would be a pain to users who are editing queries (though if
you've got the db window hidden, they are unlikely to do that,
unless you're opening queries for them in design view).

So, basically, I don't know what your question is, nor can I offer
an answer, since it's not clear to me that there is any real value
in what you seem to be attempting.

The HIDDEN status should remain the same for existing table links
when the connect string is updated, that is, the property that you
see with the properties sheet of the table, and that is related to
the OPTION for showing hidden objects.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Tom | last post by:
Hello, I've recently started trying to learn C (for the fun of it!). I have been using Perl and other languages for many years, but they were always very high level, this is giving me quite a...
4
by: Garry Freemyer | last post by:
I'm trying to convert this macro to a c# function but I have a big problem. It's on the LEFT side of an assignment statement and I am extremely flustered over this one because I'm a little rusty...
7
by: Kris Desmadryl | last post by:
Hi all, I create a new asp project, with just one button on the startup form but when I run I always get a messagebox with the error : "Error while trying to run project." That's all what I see...
5
by: tshad | last post by:
I am trying to access my log files and am running into a permissions problem. I am doing the following: ****************************************************************** private void...
17
by: Sam Malone | last post by:
I am trying to get details from a database. I really want to use only native VS.NET managed code "stuff" (just cuz I want to) and avoid any interop stuff. So, I'm trying to do this without using...
2
by: SammyBar | last post by:
Hi all, I'm trying to send a message from ASP.NET to another PC by using MSMQ. I created my ASP.NET project by using Visual Studio 2005 but I initially set the project to be located on the File...
5
by: Mike Krell | last post by:
I'm running into problems trying to override __str__ on the path class from Jason Orendorff's path module (http://www.jorendorff.com/articles/python/path/src/path.py). My first attempt to do...
0
by: UJ | last post by:
I am trying to write a routine to upload a file through a web service to our server. I've enclosed the following code and when I run it I get an error: Exception Occurred. Error: Logon failure:...
0
by: 2Barter.net | last post by:
Thank you Checkers for trying to let the Cat out of the Bag http://www.goenglish.com/GoEnglish_com_1LetTheCatOutOfTheBag.gif 21 feb 2007 --CHECKERS Daytona Beach Florida 24 oct 2006 Thank you...
5
by: BlueDream | last post by:
What I'm trying to do is simply scan in a file then whenever I get a space, turn it into 2 spaces. Whenever I get a carriage return, turn it into 2 spaces.. An example of what I'm trying to...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.