Hi
I have data tables in the form of
200612...
200701...
200702...
etc
The user specifies the start date and end date in an input form ie: 12/25/2006 - 1/10/2007.
I want to use access to link to the requested tables but maintain the internal structure already set up in access (relationships, queries, reports, etc). The tables being linked to will change frequently.
My still incomplete code follows below.
The "tbl.Properties ("Jet OLEDB:Remote File Name") = strGetDataFrom" stays undefined.
What do I need to add/change to change the Remote File being accessed?
Private Sub Report_Open(Can cel As Integer)
Dim AppointmentYear As String
Dim AppointmentMont h As String
Dim strGetDataFrom As String
Dim SeeIfMoreThanOn eMonth As Integer
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
With cat
.ActiveConnecti on = _
"Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=C:\Docum ents and Settings\Ivan\D esktop\Pernal MD PA\Access Programs\Remind er Notices SK Files.mdb;"
End With
SeeIfMoreThanOn eMonth = DateDiff("m", Forms!frmRemind erDates![Start Date], Forms!frmRemind erDates![End Date])
Select Case SeeIfMoreThanOn eMonth
Case 0
AppointmentYear = Right(DatePart( "yyyy", Forms!frmRemind erDates![End Date]), 2)
AppointmentMont h = DatePart("m", Forms!frmRemind erDates![End Date])
If AppointmentMont h < 10 Then
strGetDataFrom = "01sk0" & AppointmentMont h & AppointmentYear & ".dat"
Else
strGetDataFrom = "01sk" & AppointmentMont h & AppointmentYear & ".dat"
End If
For Each tbl In cat.Tables
If tbl.Name = "tblRecall" Then
tbl.Properties( "Jet OLEDB:Create Link") = True
tbl.Properties( "Jet OLEDB:Link Datasource") = "C:\Documen ts and Settings\Ivan\D esktop\Pernal MD PA\Access Programs\Remind er Notices SK Files.mdb"
tbl.Properties( "Jet OLEDB:Remote File Name") = strGetDataFrom
End If
Next
Case 1
AppointmentYear = Right(DatePart( "yyyy", Forms!frmRemind erDates![Start Date]), 2)
AppointmentMont h = DatePart("m", Forms!frmRemind erDates![Start Date])
LastDayInMonth = DateAdd("m", 1, DateSerial(Val( AppointmentYear ), Val(Appointment Month), 1)) - 1
If AppointmentMont h < 10 Then
strGetDataFrom = "01sk0" & AppointmentMont h & AppointmentYear & ".dat"
Else
strGetDataFrom = "01sk" & AppointmentMont h & AppointmentYear & ".dat"
End If
Case Else
Debug.Print "Please re-eneter dates"
End Select
End Sub
Thanks
Ivan
1 3338 NeoPa 32,579
Recognized Expert Moderator MVP
As mentioned in another thread I wouldn't do it this way at all - but I know you've inherited this.
This is actually quite a knotty problem as various things depend on the table being the same.
Perhaps you could have a dummy linked table that you could update the Connect string for immediately prior to using. It wouldn't work very well with multiple users unless you made it more complicated still with copies of table structures (linked tables still) and unique names etc. That may defeat the whole purpose though so perhaps not a good idea. Single user usage should be ok though.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: KemperR |
last post by:
Hello Experts outhere,
may be someone can tell me whats going wrong with my ADOX trial.
I have an Access 2002 database with some tables and queries (views)
The code listed below works well up to the point where I want to add
the new view to the views collection. I get Runtime error 3001 which
is telling me
"Arguments are of wrong type,are out of acceptable range or conflict
with one another"
|
by: Randy |
last post by:
I am trying to relink some Oracle tables in an Access database via VB.NET and ADOX. I receive the following error when executing the cat.ActiveConnection link
"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Here is my code
Dim cat As ADOX.Catalog = New ADOX.Catalo
Dim tbl As ADOX.Tabl
Dim OracleConn As String = "Provider=MSDAORA.1;Data Source=xzy;User ID=xyz;Password=xyz
|
by: Tim Frawley |
last post by:
I am attempting to change the ODBC Link Provider String in an Access
database linked to an Oracle server using ADOX in VB.NET.
I created some code using the example from post:
http://groups.google.com/groups?q=RefreshLinkedTablesWithADOX()&hl=en&lr=&selm=qb1ctvcdoftenojhpp34lb6fjb9ss8qd9c%404ax.com&rnum=1
My code simply replaces the DSN, UID, PWD and DBQ values in the
ADOXTable.Properties("Jet OLEDB:Link Provider String").Value string...
|
by: gaffar |
last post by:
Sir, Using ADOX
I am developing an application in vb.net and the backend database is
ms-access. i have created ms-access databse and tables and assigned primary
keys to the tables through the vb.net application(code is below) by using
ADOX. Now my problem is i want delete one record from master table, that
deleted record automatically deleted from child tables. so, i want the code
how to establish relation ships between the tables and...
|
by: genojoe |
last post by:
Using ADOX to update a Property does not work.
I want to change the Access database for a linked table. My abridged code is:
Dim oCAT As ADOX.Catalog
oCAT = New ADOX.Catalog
oCAT.ActiveConnection = goConnection
Dim t As ADOX.Table
Dim p As ADOX.Property
| |
by: Hexman |
last post by:
I'm creating a new Access table using ADOX. I can add columns and
indexes, but I'm baffled on how to change field properties. Can
someone give me a hand?
Want to change properties such as: Description (Column property?),
Decimal Places, Caption, Default value, Required indicator, Format,
etc....
TIA,
|
by: mazelx |
last post by:
Hi,
I'm a bit confused with all the types of connections (odbc, oledb, adox, etc...)
I'm making an application which imports the data from an excel file to a table into MS Access.
I decided to connect directly the excel file with a linked Access table (through adox), and make all my queries to the database. No need to store the data in a datatable or such!
The problem is that I don't know how to delete those tables after the user...
|
by: mchirouze |
last post by:
Hi,
I have been working on this piece of code which lists all tables in a MS Access database (including linked tables) and converts them to a DataTable with a pre-defined format. I use ADOX and Visual Basic .NET
It all works fine, except when I need to close the connection. I have read various forums on the topic, and the suggested solutions only seem to work as long as I do not try to access the ADOX.Table properties ("Jet OLEDB:Link...
|
by: parshupooja |
last post by:
Hey all,
I have Arraylist where I have stored names of Tables.I have two datasources one is SQL and one is Access, they have equal number of tabels. I am trying to find Access databse column and datatypes matches to Sql columns and their datatypes not.
I am using Adox and unable to understand what shd I do next.
here is code adn throws error on bold 'column' place
Error Cannot convert type 'char' to 'ADOX.Columns'
private void...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: 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: 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...
| |