All,
Access 2003 - WinXP
I thought this would be a no brainer, but it seems to be a perplexing problem. I have a simple table I use for importing several text reports, use VBA to run through the report to move data into tables. The temp table stays in access (tblTxtRpt), until the next report is imported, I then use SQL to DROP TABLE and CREATE TABLE to recreate it. This is because the table has an autonumber field that numbers the text report lines when it's imported. It is very important the records stay in the exact order of the report because data records on the report are on several lines.
What I want to do is hide this table so it doesn't show. Here are the things I have tried:
1. Naming the table MsysTxtRpt - Thinking that Access would consider this a system table and keep it hidden. This didn't work.
2. After creating the table I added code: - Application.SetHiddenAttribute acTable,"tblTxtRpt", True
This too did not work.
3. After creating the table I also tried; - Access.CurrentDb.TableDefs("tblTxtRpt").Attributes = dbHiddenObject
which also failed.
The reason I use DROP TABLE and CREATE TABLE is that access will not let you start an AutoNumber field over at "1" after you "DELETE tblTxtRpt.* FROM tblTxtRpt" It picks up where the last record ended. Due to the number of records (10,000+) in the txt report and the number of reports being imported, the AutoNumber field would quickly get very large and out of control. Dropping the table and adding it again solved this issue.
Here's my code for the process: - 'Import the text report into the temp table.
-
'Initialize variables
-
Set db = Access.CurrentDb
-
strSQL = "DROP TABLE tblTxtRpt;"
-
-
'Delete the tblTxtRpt table if it is still in the db
-
For Each tbl In db.TableDefs
-
If tbl.name = "tblTxtRpt" Then
-
db.Execute strSQL, dbFailOnError
-
Exit For
-
End If
-
Next
-
-
'Create a new tblTxtRpt to import the text report (Projection, Weekly, Monthly, etc. all use same table...
-
strSQL = "CREATE TABLE tblTxtRpt ([RawRec] Text(200), [RecID] AutoIncrement);"
-
db.Execute strSQL, dbFailOnError
-
-
'Hide the temporary table (tblTxtRpt)...
-
Access.CurrentDb.TableDefs("tblTxtRpt").Attributes = dbHiddenObject
-
'To unhide, unremark the below line and remark out the line above...
-
'Access.CurrentDb.TableDefs("tblTxtRpt").Attributes = 0
Any thoughts or suggestions from the experts out there would put you on my Christmas, Hanukkah, etc. list!
Thanks,
2 3395
I'm not sure how to programmaticall y hide a table, but one thing you might try is instead of dropping the entire table, just drop the autonumber field. - ALTER TABLE tblTextRpt DROP RecID
-
ALTER TABLE tblTextRpt ADD RecID Counter
If you use that to reset the autonumber field of an already hidden table, it will stay hidden.
gershwyn - Thanks for the suggestion, however in testing I find that dropping just the field and adding again does not reset the AutoNumber back to 1. I have no idea how access trcks this number, but it doesn't seem to be reset when the field is deleted / re-added.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Robin Tucker |
last post by:
I have some code that dynamically creates a database (name is @FullName) and
then creates a table within that database. Is it possible to wrap these
things into a transaction such that if any one of the following fails, the
database "creation" is rolledback. Otherwise, I would try deleting on error
detection, but it could get messy.
IF @Error = 0
BEGIN
SET @ExecString = 'CREATE DATABASE ' + @FullName
EXEC sp_executesql @ExecString
|
by: cainlevy |
last post by:
I'm wondering if there's any way to speed up create table queries?
Besides upgrading hardware, that is. The very simplest table creation
query, "create table table1 ( field1 INT(10))" is taking about .03
seconds, which compared to other queries (large inserts at .01 seconds)
and previous experience appears inordinately long. Further, it appears
that most of that .03 seconds is some kind of overhead, since the
complexity of the create table...
|
by: Alanoly J. Andrews |
last post by:
Hi,
I have two tables (that I know of) in a database that seem to be
corrupted. All SQL statements on the tables hang, "select * from..",
"select count (*) from", "delete from..". I can't even drop the
tables as the "drop table..." statement, too, hangs. But the
tables do exist as they show up in "describe table <tabname> ".
A "create table" statement fails saying that the table already
exists.
|
by: DB_2 |
last post by:
Greetings,
I was searching Google for ways to turn off transaction logging for
some queries. I came across this old post from Feb 2003:
> From: fareeda (fareeda@pspl.co.in)
> Subject: Re: Question related to "CREATE TABLE AS SELECT" in DB2
> Newsgroups: comp.databases.ibm-db2
> Date: 2003-02-27 21:11:59 PST
>
|
by: alessandro menchini |
last post by:
Hello,
First of all: i apologize for my english...i'm still learning...
If i create a view it seems that DB2 manage this view like an
updateable view.
But I need to create a view "read only", so DB2 never enables lock on
any record...
How can i do that?
| |
by: pat |
last post by:
I know this is a long shot, but is there any way of dumping a bunch of
SQL "create table" statements from an existing Access 2003 database,
to say for example, convert the database to MySQL/Oracle.
-pat.
|
by: dave.j.thornton |
last post by:
I'm attempting to create a new table, and populate it using the fields
from two existing tables. The code is printed below. I get the error:
"Run-time error '-2147217900 (80040e14)': Syntax error in CREATE TABLE
statement." For what it's worth, when tested independently, the
"SELECT " part of my CREATE TABLE statement works properly.
Sub test()
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
|
by: msg2ajay |
last post by:
hi,
i am working on <div> i have to hide some part of the table. I am not able to hide that table part can anybady tell me where is the error.
<html>
<head>
<script type="text/javascript">
function callme(){
document.getElementById("hid").style.visibility="visible";
}
|
by: GHUM |
last post by:
hello,
in my application I am using
hSem = win32event.CreateSemaphore (None, 1,
1,"stringincludinginterfaceandport")
rt=win32event.WaitForSingleObject (hSem, 0)
if rt != win32event.WAIT_TIMEOUT:
really_do_start_my_app()
else:
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |