Link Tables Via Code
Feb 7, 2007
Hey everyone I'm new here but pretty familiar with Access etc. I am extrememl;y stumped on this and I have never attempted this so any answers and details would be helpful. As we all know this is a learn new things as you develop type of application or at least for me.
I have a database that exists in one building and is functionnig fine using linked tables (File/Get External Data/Link Tables) but I now need to make this same application work for multiple locations which each have its own tables that are seperate from each other location. I was thinking a Main form that opens with radio buttons and based on the one you select would determine which tables it would be linked to when it opens. I figured Radio1 be SEDC, Radio2 be SWDC.
I have a database I have setup as a storage database for just the tables for each location that are on different servers in each location to increase traffic speeds.
Example:
SEDC (RadioButton1)
SEDC Database is located on a erver with 50 different tables in it "//sedc1/data/shared/warehouse/SEDC Warehouse.mdb"
SWDC (RadioButton2)
SWDC Database is located on server with same tables in it but different data for that location "//swdc1/data/shared/warehouse/SWDC Warehouse.mdb"
So on So on...
View Replies
ADVERTISEMENT
Oct 13, 2006
I searched and couldn't find anything on this specific issue.
I'm on the verge of designing a pretty big database and I've run into what may become a bit of a problem. There will probably be several backends in different locations. Should another backend ever be created or if the location for one changes, the user can use a form to refresh the links to the tables on that specific database.
The way I've done this so far is by having a piece of code that checks the tables for a connection string. If the table has a connection string, its a linked table, so the link gets deleted and replaced with the new link. Well this will no long work since there will be several backends and only 1 of them may need its tables relinked and using that code will delete all the table links, including the good ones.
Is there a way to make 'DoCmd.TransferDatabase' overwrite table names instead of giving the duplicate tables a number suffix? I think that doing this would be easier than retrieving the table names from the new backend and comparing them with the linked table names in the frontend so the old links could then be deleted.
View 1 Replies
View Related
Dec 28, 2007
I have a FE database that on initial setup the user will enter the drive letter of the mapped location where the BE resides. The FE will then update all the linked tables to that path. This should work but for some reason the FE locks up (stops responding) when I test this. Any suggestions as to why. It doesn't stop responding until this part of the code:
tdf.Refreshlink
I have looked and it does change the link path, but it locks up.
Dim dbs As DAO.database
Dim dataPath As String
Dim tdf As DAO.TableDef
dataPath = Me.drive & ":IMP1_R2.2_be.mdb"
For Each tdf In dbs.TableDefs
'Not a MSys type table
'If the table has a connect string, it's a linked table.
If Len(tdf.Connect) > 0 Then
If InStr(tdf.name, "MSys") = 0 Then
tdf.Connect = ";DATABASE=" & dataPath
End If
err = 0
On Error Resume Next
tdf.RefreshLink
End If
Next tdf
DoCmd.Echo True, "Done"
View 1 Replies
View Related
Sep 13, 2005
I am having trouble with a simple data base where I have 1 main form with 1 sub form, but when I try to use the form (go from design view to datasheet view) I get the message
Error Accessing File
Network Connection May have been lost.
and the link between the form and the code seems to have been lost ... I can no longer edit the vb code (it keeps reverting back no matter what I type).
When I delete the form, the VB entry remains - (since it is no longer linked with the form). Running the database this way I get error messages saying there is a Macro with a misspelled name (ie: it can't find the form with the name).
The only way I have been able to get rid of it is to create a new form with nothing in it, save it and then delete it.
Really frustrating!!!!
Any ideas on how I can get rid of this problem, best ways to re-build the data base (I have created a new one, imported the tables and created new forms from scratch ... then this problem comes back@&^^#%$@).
Thanks
View 1 Replies
View Related
Jan 19, 2005
Hi
I am linking av table from Sybase Adaptive server anywhere 8.05 by using this code:
DoCmd.TransferDatabase acLink, "ODBC", "odbc;DSN=database;UID=dba;PWD=sql;DATABASE=databas e", acTable, "trc.ansatt_dato", "trc_ansatt_dato", False
This works just fine, but I gety this dialogbox where I am asked to select a unique keys or something.... .
Is it possible to write a code to automatic choose OK?
Anyone?
eroness
View 2 Replies
View Related
Mar 4, 2005
i have two tables that only need to exist for the length of the user's session. i build them with ADOX in my backend database when the user starts up, and destroy them with ADOX when the user closes the application. the name of the table created varies, too, depending on the user (userID is built into table name).
i need combo boxes on my forms in the front end to be able to access this data.
is there a way in code, once the temp tables are built, to create a 'link tables' type of setup?
my alternative is to build the temp tables in the front end portion, but i don't really want to do that.....
View 4 Replies
View Related
Jan 29, 2008
I'm trying to figure out how to link a text file to my database with VBA. I know how to do this for other types of data sources, using the DoCmd.TransferDatabase acLink command, but need guidance using this with TXT files.
Thanks,
Randy
View 3 Replies
View Related
Oct 21, 2004
Through word of mouth I hear that you can creat a link that can go from Access and link to the personal company system. Is this true? If it is, is there a standard code to use?
View 2 Replies
View Related
May 28, 2013
I am splitting a database and have created the Back end already. When I create the front end and link to the tables on the back end... The front end does not link to all the tables in the back end. The list that comes up when creating the linkings does not show all the tables in the back end. What would cause this?
View 1 Replies
View Related
Dec 24, 2005
Hi There
i am trying to link some more tables to my access front end from the sql server back end
when i select 'ODBC Databases' from the link pop up box, the pop up box just closes
any ideas why, or work arounds would be appreciated
Happy Christmas
View 4 Replies
View Related
Jun 20, 2006
Does anyone know how to link tables automatically/VBA?
I'm trying to import files from our DB2 database in which one file is created monthly and instead of manually importing / linking the files manually, I'm looking to have access link to the new file automatically.
The file names are structured as so..
ITM01 (Jan)
ITM02 (Feb)
ITM03 (March)
Thanks
View 5 Replies
View Related
Mar 3, 2007
Hi All
I enter data in a form "WIP" that is based on a table named "WIP" in the form I have a command button. When I activate the command button it takes me into another form "Materials" which is based on a table named "Materials".
The data that I enter into "Materials" is not linked to the data ie Customer details which I have entered into "WIP".
My aim is to be able to report the materials used.
I have tried variations of relationships but am obviously missing something.
Thanks in Advance
Geoffk
View 2 Replies
View Related
Oct 12, 2005
I have a database with software
ID: autonumber
Name: text
Version: text (some say Beta etc)
Possibly 200 pieces of software
I have a database of computers
ID: autonumber
RoomName: text
ComputerName: text
Description: text
I want to link them so a computer can have up to 200 pieces of software in it or just one piece.
I dont want a table with 200 boolean fields although thats how i will end up doing it if i cant any other way.
Chances are each computer will have about 20 - 30 bits of software installed and therefore the table shouldnt need to be huge.
Anyone have any ideas how i can link these and keep the second table small. Surely i can say Computer [2] has software installed [2, 4, 5, 28, 224] but i dont know how to.
Thanks
.matt
View 3 Replies
View Related
Mar 21, 2006
I have a spilt database and both ends sit on a server. The front end has a short cut on the desktop from five machines.
On one machine I can access the backend but it i try and relink the tables, the linked table manager is empty and i cannot and the "always prompt for new location" option is not available so i cannot even do it individually that way.
Any suggestions of why this would be? Is it a security user issue (though i haven't specifically set up any user or workgroup securities)
I have even tried holding down the Shift key and that doesn't work!!
Thanks
View 1 Replies
View Related
Apr 21, 2006
Is it possible to unlink and link to tables in a back end using VBA in the front end?
I need to do this or something similar because when I send updates of the front end out I may have added an extra table and thus want to be able to get the user to run an update module to link any new tables.
Not sure if this is at all possible???
Any ideas???
View 5 Replies
View Related
May 29, 2006
Anyone can help me how to link fields in different tables. Im creating a databse that has an ID. and that ID will be same with the ID on the other table.
Table 1
ID = 123
Table 2
ID = link to (Table 1 ID) and when i input characters on the Table 1 ID field it will appear or inputed also at Table 2 ID field.
Hope some ideas. Thanks
Michael
View 1 Replies
View Related
Nov 9, 2004
Is it possible to retrieve table information from an external Access db. Then append chosen tables to the current access db by linking them?
View 8 Replies
View Related
Feb 6, 2006
I would like to link to a table that is not in the same workgroup as the database I am working in.
Both databases are from different departments - I only want read rights to the linked table to run queries against some data in my database. I have access to the database I am trying to link to - but have not been able to figure out a way to do this?
View 3 Replies
View Related
Nov 27, 2007
Hi,
I have build system DSN for SQL Server.I want to link table to the DSN.
But I can not select the DSN when I start the 'lined table Manager",I only can select files.why?
Please let me know how to link table to system DSN.
Thanks
Mark
View 1 Replies
View Related
Nov 28, 2007
I have 2 tables, an Oracle source table and an Access table. The data in the Oracle table has Item names, however they tend to end with month and date and other misc info. I set up the Access table with the cleaned up versions of the Item names (took out the excess crap) to be able to set up a query that would pull in data from the Oracle table that had Item descriptions Like the descriptions in the Access table. That is working great, however, i would also like to pull in another field from the Access table to categorize these items in to groups. Once I do this, each record shows up 4 times (the number of categories that exist). How do I link these tables to allow me to do this? None of the standard link types work since the fields are not equal but are Like each other.
View 12 Replies
View Related
Mar 21, 2006
Hi there,
I have a question: Is it possible to link more than one table to the same Form in order to keep previous data?
Thanks a lot
View 1 Replies
View Related
Nov 23, 2004
What I need is a table that will hold a primary key field and 16 text fields at 255 characters per field. (NO memo fields) This will total about 4,080 characters but Access 2000 limits the record size to 2,000 characters.
I have two tables with 9 fields in each table in a one to one relationship as follows:
Table1: Primary Key = MyKey = autonumber field.
Table1: 8 fields = text at 255 characters each field.
(i.e. Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8)
Table2: Primary Key = MyKey = number field.
Table2: 8 fields = text at 255 characters each field
(i.e. Data9, Data10, Data11, Data12, Data13, Data14, Data15, Data16)
The problem is I want all the fields to act as though they are from a single table and to be on a single form. I don’t know how to go about the LinkChildFields and LinkMasterFields without using a SubForm. A SubForm don’t work because it expects the second table to have many records.
Thanks Stan
View 3 Replies
View Related
Nov 7, 2005
Hi
Can you tell me if the following is possible and if so how to do it.
I have several different tables which require a date to be entered.
99% of the time this date is the same ie
(Table 1) Visit Date = (Table 2) Scan date 1
(Table 1) Visit Date = (Table 3) Scan date 2 etc.....
However in some cases Scan date 1 and/or Scan date 2 may not be the same as Visit date so the input does need to be editable.
Is there anyway I can link the information in Table 1 to automatically be displayed and stored in Table 2/3 and to be able to edit Tables 2/3 if the scan date is different to the visit date which it could be for a small number of records.
Is this possible or is it simply impossible to do this.
Thanks for any advice.
View 1 Replies
View Related
Apr 19, 2007
I have been able to link column A1 in Table A to Column B1 in Table B.
But I want to link Columns A2,A3,A4 to Columns in table B using A1 and B1 as the relationship. Can this be done??
I want to end up with a Table that would be automaticly updated with the columns.
Thanks
View 1 Replies
View Related
May 19, 2006
I have 4 databases that share 3 tables.
Each database is used for different purposes and other tables which do not relate to the other databases.
My question is: how do I set up the back ends so each database can retrieve and enter data into the 3 shared tables without conflicts??
I know how to split each of the databases to front and back ends but how would I link them all to the 3 tables they share? Should I create one back end with only the 3 shared tables and link the separate back ends for each database???
Any help much appreciated!
View 4 Replies
View Related
Jul 11, 2007
I have two table which is c:db1.mdb; c:db2.mdb
The user is currently using c:main.mdb
In main.mdb, I have a form, and have a combobox with two value, which is db1.mdb and db2.mdb.
If the user choose db2.mdb, delete all the current db1.mdb link tables(if there is any), and import all the tables from db2.mdb as link table
If the user choose db1.mdb, delete all the current db2.mdb link tables(if there is any), and import all the tables from db1.mdb as link table
And I need to perform some vba on the afterUpdate event of combobox.
My question is, how to
1)delete all link tables using vba
2)Import all tables from a certain mdb file as linked table using vba?
View 1 Replies
View Related