Modules & VBA :: How To Get ForeignTable Field And Relationship Types Using It

Jul 25, 2014

For reasons I need not get into as it generally proves to be a distraction, I need to document the relationships in databases.

I've been playing around with .Relations with some success.

I can easily get the relationship's name, Table Name, Table Field, and ForeignTable.

Code:
For i = 0 To objDestDB.Relations.Count - 1
With rsMigrateRels
.AddNew
!RelNumber = i
!RelAttributes = objDestDB.Relations(i).Attributes
!RelFields = objDestDB.Relations(i).Fields.Count
!RelFieldsName = objDestDB.Relations(i).Fields(0).Name
!RelForeignTable = objDestDB.Relations(i).ForeignTable
!RelName = objDestDB.Relations(i).Name
!RelPartialReplica = objDestDB.Relations(i).PartialReplica
!RelProperties = objDestDB.Relations(i).Properties.Count
!RelTable = objDestDB.Relations(i).Table
.Update
End With
Next i

However, despite lots of digging into the other properties and attributes associated here, I cannot yet figure out how or where to get the:

ForeignTable field
The type of relationship (1:1,1:many,many:many)

View Replies


ADVERTISEMENT

Relationship Types

Jan 12, 2006

Hi,

I'm a student trying to get to grips with relational databases and Access is a great tool to learn.

Does access support 0..1 and 0..many relationships? I've been playing around with Access for a while and can't seem to model the 0..1 and 0..many relationships.

Thanks for your help

Jack

View 2 Replies View Related

Field Types

Sep 10, 2006

I am building a table where one of the fields is a yes/no field type. When the yes box is selected, I need to "jump" to a different set of field names than field names for selecting no. I have researched on internet and have done some reading but have found no information. Is it possible to do what I want to do in Access? My skill level is that I can build tables, create forms, create reports and run simple queries. Any help offered is appreciated.

View 8 Replies View Related

Modules & VBA :: Mixing Variable Types

Jul 26, 2013

Dim MooringLines As String
Dim MooringLinesPrice As Double
MooringLines = DLookup("TotalComponent", "ComponentT", "[TotalComponent] = '" & Me.P_MooringLinesCmb & "'")
MooringLinesPrice = DLookup("EuroPerMetre", "ComponentT", "[TotalComponent] = '" & Me.P_MooringLinesCmb & "'")
Me.P_MooringLinesTxt = (MooringLines + " - " + (MooringLinesPrice * Me.P_LengthMLTxt.Value))

In the first variable I'm trying to get a string and combine it with a double in the second. Is it that I can't mix a string and a double in the one variable and if so how do I convert the double to a string?

View 4 Replies View Related

Modules & VBA :: List Of Orders - How To Keep New Types In Same Table

Oct 26, 2013

I have a query which is my list of orders. Now I want to create other type of orders. New types don't use the code in red (tbl Offset and tblRodzajZlecenia). Is it possible to modify the query, in order to keep new types too?

New types of orders are in the same tables. But if I don't fill fields in tblOffset then query can't show new type of oder - that's the problem.

Code:
SELECT z.ID_Zlecenia AS ID, tblRodzajPracy.RodzajPracy AS [Rodzaj pracy], tblRodzajZlecenia.RodzajZlecenia AS [Rodzaj zlecenia], z.NazwaZlecenia AS [Nazwa Zlecenia], k.NazwaSkrocona AS Klient, z.DataPrzyjecia AS [Data Przyjęcia], z.TerminOdbioru AS Termin, tblStatus.Status, tblStatus.lp
FROM (tblKlienci AS k INNER JOIN ((tblStatus INNER JOIN tblZlecenia AS z ON tblStatus.Id_Status = z.Status)

[Code] .....

View 1 Replies View Related

General :: Attachment Field Types

Apr 12, 2013

I have a database for recording jobs and invoices for our transport company. I was thinking of adding an "Attachment" type field to my invoice table to store pdf's of scanned copies of the delivery notes relating to the invoice. How this will affect the performance of the database? Will adding this field greatly increase the size of the database and slow the whole database down?

View 1 Replies View Related

Attaching Files Of Different Types To Table Field Thru VBA

Apr 23, 2007

Hi Everyone,

I have a PO table. Each PO has 3 documents of multiple types (one may be Word, other may be Excel, Acrobat). When I display the PO, the attachments should be shown as Icons, which when double-clicked, will open in its own Application.

I have a pop-up screen where I enter new PO details. In this screen, I have Attach/Detach buttons for each of the Documents.

My Requirement:
When I press 'ATTACH' of Doc1, the File Selection screen should be displayed from where the user will select the file to be attached. This file should be updated into the table field "doc1".

When I press 'DETACH' of Doc1, the file in table field "doc1" must be cleared.

How can I achieve this???:mad:

View 1 Replies View Related

How To Display Field Types Of Access Tables In Vba?

Apr 5, 2005

How to display field types of access tables in vba?
can any one show me how i can display display field types(like : phone integer ....) of
access tables in a text box using vba? I have no idea how i
can obtain that information using vba. Looking forward to your
replys.Thanks

View 1 Replies View Related

Link Two Tables - Changing Field Types

Jun 11, 2012

I am needing to link two tables but one field is in a "May 2012" format while the other table is in a "053112" format.. Is there a way beyond creating a formula to change "053112" into "May 2012"??

View 2 Replies View Related

General :: Modules Not Appearing As Object Types In Navigation Pane

Apr 19, 2013

I am now working on this new database. I would like to make a calculation so that I could derive a value called eGFR from a patient's serum creatinine. This is a test of kidney function.I am having the following problems.

a. Modules are not appearing in the Navigation Pane of the Access 2007. When I press 'Object Types' in the Navigation Pane I get all object types such as tables, queries, forms, reports, macros but not modules. I know there are modules as I have written lots of vba code.

b. I have written the following code within this Function. The following is the code.

Public Function eGFR(creatinine, Gender, Age) As Single
If IsNull(Age) Or IsNull(creatinine) Then
eGFR = 0
Else

[code]....

This code is working fine in another database, however when I try to upload a query in the current database that has this function in one of the fields, I get an error saying the the function eGFR does not exit.

I have inserted the function into one of the modules that I have managed to enter.

Do I need to deposit the code elsewhere? How do I access Modules from the Navigation Pane?

View 2 Replies View Related

Summarization In Report Footer With Two Types Of Output From Same Field

Mar 22, 2007

Hello everyone

I am in need of assistance with Microsoft Access. In the reporting function of Access I am trying to have a summarization total of indirect time and direct time based off a Auditor Timesheet form developed. On the report I am able to see both the direct time and the indirect time hours seperate per auditor based on the query that is run to seperate direct and indirect hours and each individual auditor stats.

but the problem I am having is trying to summarize on the report the total direct and indirect hours as a whole.

Please let me know if this a simple solution by building an expression in the field for the report or some type of VBA code input which would suffice?

Thank you

View 2 Replies View Related

General :: Create A Spec File Or Set Field Data Types

Jan 26, 2014

Looking for a way to use transfertext to make a table and create a spec file from csv files I am importing. I want all fields in the table to be shorttext.

Otherwise I need another way to bring the files into a table.

I have a generic spec to use that brings in any data as text.

Created the spec from a delimited file with 255 text fields... Field001, Field002, etc.

However the field names need to be changed. My field names are in the first row of a table. I will need to read each fields data in the first row and rename the field.

View 1 Replies View Related

Access Field Types Change When Relinking Data From Sql Server?

Jan 25, 2014

We have been using an Access (Access 2013) program where we link the program to dataviews created in sql server.

Recently we had to re-link the data views because a change had been made to them. When we relinked the data we noticed that the field type for the field used as the primary key changed from "Short Text" to "Long Text". The programmer who created the dataview from sql server said that nothing was done at that end that would have caused the change

I know how to prevent the problem from recurring. We are changing the sql server spec from VARCHAR(8000) to CHAR(20).

View 1 Replies View Related

Modules & VBA :: File Open Dialog Does Not Allow Selection Of All File Types

Oct 4, 2013

I recently upgraded a DB from 2003 to 2013 and ran into the following problem.

I have a button that opens a file dialog box and allows the user to upload a file to a predetermined location (and store the address as a hyperlink). I borrowed this code from someone else on here and modified it slightly.

In any case, the button still works, but now when it opens it doesn't have an option for "All files" under file types. So I can upload MS Office files, text files, etc., but not PDF files which are by far the most common types my users upload.

Here's my code and a screenshot is attached.

Private Sub Command35_Click()
Dim dd As Integer
Dim fileDump As FileDialog
Set fileDump = Application.FileDialog(msoFileDialogOpen)
dd = fileDump.Show

[Code] ....

View 3 Replies View Related

Modules & VBA :: Append Records From 2 Tables With 1 To 1 Relationship

Dec 30, 2013

I have a db using 3 large tables with 1:1 relationships. Before you question my normalization, I stress that these tables are strictly used to temporarily store user input information for a highly automated form with several hundred fields. All of the bound fields enable the form to be reopened and retain the information originally entered. The information is then transferred to a report and converted to a .pdf where it is filed; these 3 table's records are deleted weekly with a delete query. Other than a few combobox row source queries, these 3 tables are not connected to the rest of my db. At this point the form is functioning perfectly.

What I am trying to do is save about 3-5 of the partial (records) on 2 of these tables for indefinitely, no longer needed, or overwritten. Reason being is that partial information (records) on this form can be recalled and duplicated into a new form, saving the user time from having to completely re-enter some fields that will not change week to week.

So far, my best idea is to have 2 duplicate tables that store these records (based on a checkbox on a scheduled query event) that can be recalled and written back into the 2 main tables with a new primary key when needed. Append queries only work with one table at a time, and I need to maintain the integrity of these records 1:1 across the 2 tables with their primary keys intact.

View 5 Replies View Related

Field Relationship Problem

Jun 13, 2007

Hello all,

When I try to create a relationship between 2 fields of 2 different tables and that I choose "enforce referential integrity", the an error message appears, saying that the relationship should include the same number of fields and same type of data.
But I chose on field of each table to create the relationship, and both are of the same type in their respective tables...
Can someone help me?

Thans

View 1 Replies View Related

Multiple Field Relationship

May 3, 2007

I am trying to conduct a query that is based on two separate queries. Is there a way to that the queries can be related based on multiple fields?

View 1 Replies View Related

Relationship Using An Autonumber Field

Apr 3, 2006

What am I doing wrong that I cannot get this to work?

I have a table with Patient Details - the Primary key being called PatientID and this is an Autonumber.

I then have a table called Episode Details. I want them to be linked via the PatientID. When I set up the forms however, it won't work.(Relationship PatientID - PatientID one to many)

I think it is something to do with the Autonumber but can't work out what...

View 1 Replies View Related

Field Relationship Understanding Needed

Jun 5, 2006

ok, let me please ask this question regarding a payment relationship in my database

it will be paid in four ways, cash, creditcard, cheque, paypal

each of these payment types will have their own features..

eg creditcard (name on card, card number)

cheque (cheque date, date cleared)

paypal (username...YOU GET THE PICTURE

so is this below way a good way to store these details, or can i do it with 4 less tables..

http://bb.1asphost.com/antonyx6/untitled2.jpg

if this way is correct, i dont see how each id will be entered..
eg
if i enter some cheque details.. will that lead the chequeid to be linked to the paymentid, and the paymentid to the bookingid, and the bookingid to the booking details etc

View 5 Replies View Related

Multiple Field Line Relationship In Access

Jun 29, 2015

Why and where do we create a multiple field relationship in Microsoft access.

The relationship between CompanyContacts and CompanyProducts.(Adopted from Microsoft access 2013 inside out by John Viescas).

What was the main purpose of using such a relationship here and where are such relationships frequently created.

View 7 Replies View Related

Tables :: Making Table Relationship When One Field Has Extra Zero

Nov 29, 2012

I have two tables containing data from two separate sources. The unique "link" between the two is a JobNumber field. I need to set up a relationship between the two tables using the JobNumber field.

Problem:

In one table, the JobNumber has been input in this format: 12-00345-01
In 2nd table, the JobNumber has been input in this format: 12-00345-1

How can I tie these when the 2nd table is missing the "0"?

View 8 Replies View Related

Create Relationship Between Multiple Field Primary Key And Another Table?

Aug 4, 2015

In table 1 fields Factor, Aggregations, Stat, and Days Back are fields that make up a multi-field primary key [URL].

I want to create a relationship between that multi-field primary key and another table, call it table 2, and make it a one-to-one relationship.

How do I do this in MS Access 2013?

View 3 Replies View Related

Creating Relationship Based On Part Of A Text Field

Jan 27, 2014

Each each record in table1 has a unique four character (alpha-numeric) code to identify it. The first two numbers of this code represent the group it is in. (Ie. 15AB and 1502 are both grouped together) The second table stores values that apply to the entire group. I need to create a relationship between these two tables based on the first two characters in the ID field.

Things I've tried:
* Making a calculated field with left$() formula - Access doesn't allow relationships on calculated fields
* Create a new field for just the first two characters and create a data macro for after update and after insert to update that field with the expression - cannot edit the field the user is on

View 4 Replies View Related

Forms :: Subform To Popup Relationship And With Refresh Of Calculated Field

Apr 3, 2014

I have a "Main" form called frmProjects that sports multiple tabs. One of those tabs is labelled "Milestones", into which I inserted a datasheet subform called frmSubMilestones. The table that feeds the subform is tblMilestones. I established the parent / child relationship between frmProject and frmSubMilestones, and everything is working just fine...

To summarize: frmProject as main form -> Milestones Tab on main form -> frmSubMilestones as datasheet subform on the Milestones Tab (there are other tabs that are not subforms).

I have been asked, for each milestone in the frmSubMilestones subform's datasheet, to capture the number of days spent by employees on a monthly basis. The Milestones table and the PersonDays table have a primary key and a foreign key that are similar.

To summarize: frmSubMilestones as subform -> txtAggregatePersonDays as calculated Textbox fetching data from tblPersonDays -> OnClick event -> FormLoad of frmPersonDays as datasheet PopUp form.

DoCmd.FormLoad is supplied with the usual parameters to make the PopUp form appear, filtered on the currently highlighted milestone. Everything works fine so far... well almost.

Problem 1: When I introduce new rows in the frmPersonsDays datasheet, everything seems fine at the surface, BUT the primary key of the calling form (i.e. frmSubMilestones) does not appear in the tblPersonDays table; this is normal because there is no form-based parent / child relationship between the two forms. As one might expect, I am trying, from frmPersonDays, to get the primary key value from the "parent" frmSubMilestones using the Forms collection. No dice. I surfed and surfed, tried the bang and the dot operators, drank scotch, but nothing worked. I had to add foreing keys manually in tblPersonDays to further my tests. I can't figure out how to reach any control on the calling form, which is a subform.

Problem 2: The calculated txtAggregatePersonDays on the frmSubMilestones works wonders for existing data in tblPersonDays. However, when I introduce new rows in the PopUp form, I also realized that the calculated Textbox in frmSubMilestones is not updated when I close the frmPersonDays PopUp. I have to close the PopUp form and move the cursor in the Main form (frmProjects) to refresh its associated milestones.

View 3 Replies View Related

Data Types

Sep 5, 2005

I have an Excel file (sourced externally) linked as a table. All fields are defined as text fields. In some of the Excel cells, data has somehow been entered as numeric (eg phone number). When I query the Excel file thru Access, these fields show up as errors (#num!).

I need to find a way of interogating the field, and if in error (like these ones), then ignore it, or replace with zeros etc.

I cant find a way of doing this. Help :)

Rod

View 1 Replies View Related

Yes/no Data Types?

Jul 18, 2007

Hi all :o

Just a quick stupid question, I have a Yes / No data type in my table but I want it to automatically put no unless I change it to Yes, is there an easy way to do this, probably a really simple question but am new to this and any help would be great

Thanks

Jackie

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved