|
-
Nov 9th, 2009, 06:05 PM
#1
Thread Starter
Member
Copying MS Access Table with code
Ok...I have done a fair amount of searching...no luck...Originally I was trying to create a new table and change the input mask with code, no such luck.
Now I am trying to copy the MS access table(hoping to keep the input mask). I have the table copying and renaming, but it fails to keep the input mask...
So far this copies and clears the table, is there anything I am missing to make it keep the input mask
The code below is what I am using:
vb Code:
Query = "SELECT * INTO [test] FROM [tblAccounts] WHERE 1=2"
comm = New OleDbCommand(Query, conn)
Try
conn.Open()
comm.ExecuteNonQuery()
Catch ex As OleDb.OleDbException
Catch ex As Exception
MsgBox(ex.Message & vbCrLf & ex.StackTrace)
Finally
If Not (conn Is Nothing) Then
comm.Dispose()
comm = Nothing
End If
End Try
Thanks for any help
-
Nov 9th, 2009, 07:47 PM
#2
Re: Copying MS Access Table with code
If they have Access installed then you can use the Access Object Model and execute the .TransferDatabase funciton.
This is VBA code but is easy to do in .NET
http://www.vbforums.com/showthread.php?t=409309
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|