Lookup Table Confusion

Nov 21, 2007

Hi everybody

I have been unsure about this topic and want to finally be sure.

When I create a lookup table I don't include a PK; I just have the one field. Therefore I don't include an FK within the Main table; I include the same field name as the field name in the lookup. "sector Details" in lookup and "sector Details" in Main.

Am I better to make up these lookup tables and use a PK and then have the FK within the Main Table? Is this easier or trickier to work with? And will it cause any problems if I did include keys? for example, providing combo boxes as search criteira for forms using the FK/PK as bound fields?

I know it's a bad idea to have lookup fields in tables which I'll avoid. But this means if I'm updating in the back end I'll only see a table full of keys and not the field name!

Hope someone can help because I've been getting different advice since I started on Access including Professional books using lookup fields.

Thanks.

View Replies


ADVERTISEMENT

Syntax Confusion

Aug 28, 2005

Greetings all,

I am trying to run the query below to tell me how much stock a company has available by deducting the amount dispatched from its allocation. I am getting an error message;

Run Time error '3061'
Too few parameters expect 2

The code is;

Dim db As DAO.Database, qr1 As DAO.QueryDefs
Dim rs1 As DAO.Recordset, rs2 As DAO.Recordset
Dim varVal0 As Variant, varVal1 As Variant, varVal2 As Variant
Dim strSQL As String
Set db = DBEngine(0)(0)

VarVal0 = Me.WINENUMBER

strSQL = "SELECT Sum(tbl_Data_DispatchLineitems.Amount) AS Amount "
strSQL = strSQL & "FROM tbl_data_DispatchDetails INNER JOIN tbl_Data_DispatchLineitems ON tbl_data_DispatchDetails.DispatchID = tbl_Data_DispatchLineitems.DispatchID "
strSQL = strSQL & "GROUP BY tbl_data_DispatchDetails.TradingName, tbl_Data_DispatchLineitems.WineNumber "
strSQL = strSQL & "HAVING ((tbl_data_DispatchDetails.TradingName)=[Forms]![frm_data_Orders]![TradingName]) AND (tbl_Data_DispatchLineitems.WineNumber = VarVal0)"

Set rs2 = db.OpenRecordset(strSQL)
rs2.Edit
varVal1 = rs2![Amount]
rs2.Close


I assume the error lies in the final line of the query code. Any help to find the error would be appreciated.

Thanks in advance.

~rbinder

View 1 Replies View Related

Query Confusion

Oct 27, 2005

I am having a problem creating a query on a MS Access database and would appreciate any help.

I have 4 tables:

Table1 – Name_ID, Name, and Address
Table2 – Donor1_ID, Name_ID, Donor1_Item, Donor1_Item_Description
Table3 – Donor2_ID, Name_ID, Donor2_Item, Donor2_Item_Description
Table4 – Donor3_ID, Name_ID, Donor3_Item, Donor3_Item_Description

The Name_ID in each Donor Table points back to the Name_ID in Table1.

What I want to do is get a list of the Name, Address, Item and Item_Description for any record found on either Table2, Table3 and Table4 and then sort the result set by Name.

My tables are all very small – 100 entries at most on any 1 table.

My queries so far are returning 40,000 and 50,000 records – I assume because I am writing SQL that forces sub-queries.

I am more familiar with SQL using Where Tbl2_Name_ID equals Tbl1_Name_ID or Tbl3_Name_ID equals Tbl1_Name_ID or etc rather than inner joins or left joins so I am struggling.

I know this has to be elementary, but I am missing it.

Thanks for your help

View 2 Replies View Related

Problem, Sql Confusion?!?

Nov 12, 2006

I'm trying to show an overview of the green and red cars which were bought in june or before, ordered on price, I have this:

SELECT car.carname, car.colour, car.Bdate, car.price
FROM car
WHERE (((car.colour)='red') AND ((car.Bdate)<6)) OR (((car.colour)='purple'))
ORDER BY car.price;

It works all except for the <6 part (doesn't work with =<6 etc either). The month is only used in this column and represented by a number i.e. 6.

I hope this is clear and I hope somebody can help me with my problem!

Thanks in advance.

View 2 Replies View Related

ListBox Confusion...

Jun 24, 2005

Okay,

I have a listbox that populates it's values from a table. Upon the click() event, I run a script to determine the current record for the rest of the form. One of which is an TextBox bound a field in the table the ListBox is populated from.

I store the old values in the Form_Current() method, and allow the user to change the values in the TextBox, and upon textbox_change() I enable an 'Apply' command button.

When the Apply Button is pushed, I set the "saved" data to the actual current data (since the control is bound to a record field), and thus the changes are fully applied. However, I cannot seem to get the ListBox to update it's 'text' display to represent the changed value from the textbox.
I have tried ListBox.requery, but it doesn't work instantly...it sometimes is delayed until I change "apply" a new set of changes.

Why is this?

Specifics:
Table
AreaID (AutoNumber)
Area (Text)

Query
Table.*

AreaList.RowSource = Table
AreaEdit.ControlSource = Area


Private Sub AreaEdit_Change()
Dim St As String
St = AreaEdit.Text
Debug.Print "Chg Text: " & St
Call UpdateChanges(True)
End Sub

Private Sub UpdateChanges(ByVal Value As Boolean)
ChangesMade = Value
ApplyBtn.Enabled = ChangesMade
End Sub

Private Sub ApplyBtn_Click()
AreaList.SetFocus 'this is because you can't disable a control (the applybtn) when it has the focus
AreaList.Requery '<==== THis is supposed to repopulate the listbox, but it doesn't do it.
Call Form_Current 'this just stores the current values of the actual record into temp variables
Call UpdateChanges(False)
End Sub


Thanks

Jaeden "Sifo Dyas" al'Raec Ruiner

View 3 Replies View Related

Check Box Confusion !!

Mar 7, 2005

hi ..had a quick search through the pages, no luck.

i have 8 check boxes on my Search form. If i check one of them...i want to send certain text to a field. is this possible? eg: i have 8 check boxes with different project names, if i check my check box named "Laem Supot" i want the the text "Laem Supot" to be sent to my Project Field on my listbox.


i found a similar for a date value:

Me.yourcontrolname.Value = date() .....(would this work and how do i implement it)

however i may need to check 2 or more check boxes, therefore i can't send 2 project names to one field.
My clients may be associated with 2 or more projects, how do i show this or represent this in my SEARCH FORM.

any solution??

View 3 Replies View Related

Coding Causing Confusion - To Me

Apr 20, 2006

Yesterday I posted a question and rec'd good advice but as usual I don't think I explained myself very well.
As the attached picture of my Form shows, I have a checkbox for each Age Group under each Team. I originally had a query that would come up for each Team's particular Age Group and then the required data copuld be input. This leads to too many querys clogging things up. I tried to copy the SQL code of one of the query's to the On_Click event of the checkbox but as I have been informed SQL is different to VB.
All I would like to know is how to convert the SQL to VB coding so that I can continue to do the coding for each Checkbox.
The SQL code for the first checkbox is:

SELECT tblPlayerRegister.Surname, tblPlayerRegister.[First Name], tblPlayerRegister.Age, tblPlayerRegister.[D'n], tblPlayerRegister.G1, tblPlayerRegister.SP, tblPlayerRegister.Age2, tblPlayerRegister.G1A
FROM tblPlayerRegister
WHERE (((tblPlayerRegister.Age)<11) AND ((tblPlayerRegister.Club)="Beaconsfield"))
ORDER BY tblPlayerRegister.Surname, tblPlayerRegister.[First Name];

If there is an easier way, by all means let me know.
Any assistance would be greatfully appreciated.

View 1 Replies View Related

Relational Modelling Confusion !!??

Mar 9, 2005

Im trying to figure out how to model 'Printer' and 'Cartridge' information. The relationship between them is Many to Many, but to add to my confusion, more than one cartridge can be used in a printer (Black + different colour cartridges). Adding a new entity to resolve the Many to Many does not solve this issue of how a printer can have, for example, a black cartridge and 3 different coloured cartridges.

Any ideas how to model this please?? I have been toiling with it for some time and I keep going round in circles :confused:

I'm sure it shouldn't be as difficult as it seems, so I'm hopeful someone might be able to set me straight :o

View 1 Replies View Related

Append Dates - US/UK Confusion!

Feb 27, 2006

Hello All,

Hoping you can ride to my rescue...again! :o

I have a series of append queries that run when a database opens, to copy over the contents of various log files into a single table.

Each record has a field, [1-DateTime], which (surprisingly!) contains a date/time. When I open the linked text files from Access, these appear absolutely fine, all in US format (mm/dd/yyyy hh:nn:ss). But when I run the append query, it gets all confused, and puts them into my table in a conbination of formats!

Those that it can recognise as UK dates (e.g. 01/05/06) it stores as 1st May 2006, but then it gets to 01/22/06 and it decides that they must be US dates, so stores them (CORRECTLY) as 22nd January 2006.

Hope I have explained myself sufficiantly!

View 1 Replies View Related

Nested Query Confusion

Sep 23, 2007

Dear Access Expert

I have been doing some experimentation with Queries and I have discovered something unusual.

If I have one query and I use the totals feature (only using group by) I get all the records based on the inputed criteria

If I then use that same query as an underlying recordset for a second query and I use the totals feature (only using group by) in the second query... I only get the first record of each type. See query results below..

I am trying to achieve the results of the second query in the first query (DON'T WANT NESTED Queries) and I don't really understand why the results of the queries are different when everything else is the same other than one being nested.


Example below

First Query Results (using totals with group by)

1 a
1 a
1 a
2 a
2 a
2 a
3 a
3 a
3 a
4 a
4 a
5 a

Second Query Results with the First query as its recordset (using Group By)

1 a
2 a
3 a
4 a
5 a

View 3 Replies View Related

Tavular SubForm Confusion

Dec 9, 2005

I do have questions about tabular subforms. I have created several forms and I thought that they were linked together. The main form (GSI) is general information about each site that we visit. The tabbed forms are about various survey's done on a site. So, what I thought would happen is; I'd fill out the info on the GSI forms about each site. I'd go back after doing a survey, look up that site, click on the corresponding survey tab and add information about that survey and It would link back to the site on the GSI. What is happening is, when I pull up a site and add survey data the same survey data comes up in the next site also. I think, the problem is,

I have a switchboard with Add new site and Edit site. When I go into Edit site and I do a search by Site name, it pulls up the name, but not the record, so I'm just changing the site name by doing it that way. If I move down to the bottom of the form and scroll or move through the records that way it works right, but I need it to be more user friendly. I'm sure that there is a statement I could create to do this, but I'm not knowledgeable enough to know what it is. :confused:

View 3 Replies View Related

Corruption Confusion- Any Ideas Are Appreciated

Mar 24, 2006

I'm running Access 2000 through Citrix, 20 users internationally from 1 db. I'm working through Citrix network issues to split db with separate FE's for each user.
I have sporadic corruption due to this. But this morning I met a new breed of corruption. I preface this with the fact that I run a bat file nightly to do clean up and compact and repair the db. It verifies the db is not in use prior to running.
This morning we were presented with a hosed db.
The log file said updates ran fine.
In my main table the first record was garbage, including the Auto-num field. I found that my Primary key has lost it's index and references had become unchecked.
Correcting these issues got it running but does anyone have any clue what might have triggered this or even where I should start looking? Please help as I am at a loss.
Thanks.

View 2 Replies View Related

Access Record Locking Confusion

Oct 6, 2006

In OPTIONS -> Advanced I have the option Open Database using Record-Level locking ticked.

What is strange is record level locking works on Form1 (Form1.recordlocks= Edited) as long as Form2 has Form2.recordlocks = No Locks. If I change the Form2.recordlocks = Edited, Form1's locking becomes page level locking.

This is even true if Form2 is not open...

Additionally, Form2's locking is always page level locking if Form2.recordlock = edited.

I would like all my forms to perform RECORD level locking not page Level locking. How do I accomplish this.

I've been trying to resolve this issue for about 2 months now but no answers from the community.

Thanks for any comments.

View 8 Replies View Related

Form For Comic Book Confusion

Apr 6, 2005

hello, this is frazzling my brain i cannot comprhend the answer :confused:
sorry werent sure were 2 post this hope this is the right place

I have an array of comics 300 they come out weekly, the first is Number: 344 this came out 26th September 1983, i have a form with a combo box were i select the comic number (344 - 700+) in this case i am selecting 344 and i press a button "command 11", i would like it to display in three text fields, date, month and year. This has well an truly killed off my brain. Any help would dearly be appreciated.
Need any further information just ask.
Paul

View 6 Replies View Related

Date/time Period Criteria Confusion

Jan 30, 2008

Hi there

I have created a database in Access XP (2002). In a nutshell, the database records numbers of people attending a seminar; which can take place any number of times per week, and so hence can take place any number of times per month.

I have set up the query so that it can run immediately after a seminar to show the attendants who attended the seminar on that current date "Date()" in the criteria box. However, how would I go about setting it up so that it shows who attended every seminar in the current week or month?

View 1 Replies View Related

Modules & VBA :: Restrict Value In Lookup Field To Only Include Values From Table B Not In Table A?

Feb 2, 2014

I have a database that has 2 tables. Table A and Table B. Table A is my primary table. On this table I have 2 fields. The first field is a LOOKUP Field that looks up information from Table B and displays my selection in the field on Table A. Then using DLOOKUP I automatically input the information in the Second Field on Table A based upon the selection from the First Field.

This is working mostly correctly. However, the problem is, when I click on the next record in the table, it automatically changes the Second Field on that record to the same value as the record before it and continues this trend each time I click on another record. This occurs without me making a selection in the first field. If I make a selection in the first field it does change the Second Field to the Correct Value, but then the next Record has the same issue.

How do I go about fixing this so it doesn't change the value with the change of the record. Only change if I change that particular field within that 1 record?is there a way to restrict the Value's in my lookup field to only include the Values from Table B that aren't already in Table A?

View 5 Replies View Related

Tables :: Two Fields In A Table / Link To Same Lookup Table

Mar 14, 2013

I have a table "Product" and in this table I have two fields "StoragePlaceID1" and "StoragePlaceID2". Both these fields link to the look-up table "StoragePlace"

*Attached Image "Product_StoragePlace" from the Access Relationship Window"*

When I want to add a new Product from my inter face i get the error you can see in the Attached Image "Save_Error".I think the problem is that the Relationship is defined as One-to-Many,there a way to define the relationship as Zero-to-Many.

View 5 Replies View Related

Table Lookup - Row Source From Another Table - Only Showing Numbers

Feb 11, 2012

When I have a 3rd table looking at the row source of the 2nd table, which is looking at the row source of the 1st table. I only get numbers.

Everything I have read so far points to using a query as a solution. However, the query I made is not updating the information from the 2nd table.

I have attached a few examples.

Attachment 6247

this below shows. I changed "Bakersfield-test1" in the original table. However, the query I made does not update, still showing "Bakersfield-test". When you click on the drop down, it shows the updated "Bakersfield-test1", but it does not repopulate my column with the updated info from the table.

Attachment 6248

View 4 Replies View Related

Need 2 Fields From Table 1 / Using Lookup Info From Table 2 And Put Into Table 3

Jun 28, 2013

I need to get x and y coordinates for each device, but the data has to get looked up from 2 other tables.

I have a table (called InstReclosers) that has device names. Each device is on a Section. I can go to another table (called InstSections) and look up what Node that particular section is tied to. Then I need to go to another table (called Nodes) to get the X and Y location for that particular node.

How I can go about getting this X and Y data into the InstReclosers table?

...in summary, InstReclosers has device name and section name. InstSections has section name and node name. Nodes has node name and XY coords. Need XY coords for each device in InstReclosers.

View 3 Replies View Related

Lookup Table

Jan 6, 2006

I am very new to Access and any help would be appreciated. I have been through the entire Access Bible and many forums but can't find the answer to my specific question.

The project:

I'm setting up a database for tutors and students. Tutors will, via the web, enter data about a specific tutoring session (studentName, subject, sessionLength, etc.) Then at the end of the month a report will be generated detailing hours tutored and total compensation.

The problem:

Students pay varying rates based on subject (math or verbal). So in the Session table each record for each tutoring session has an empty field called payRate. This is the rate the student will pay based on subject. So I need this field to "fill in" automatically based on the 'student' and the 'subject' from the same record. Then I can multiply the field by sessionLength and get a totalPay field for the session. Add these at month's end and pay the tutors.

I've set up a lookup table called 'subject' with three fields (student,subject, payRate) and I have the student and subject combined as the primary key. Am I on the right track here? If so, how do I link the tables to get that Session 'payRate' field to fill in automatically. This is where is breaks down for me. I've tried the lookup wizard but all I seem to get when I open the Session table is an empty PayRate field with a drop down box containing the entire subject lookup table.

Sorry for being so long winded but I need help from someone better at his than me. Thanks in advance.

View 6 Replies View Related

How To Use A Lookup Table

Apr 24, 2015

My experience has been with SQL Server using Delphi and other languages where code is written for data integrity. A local service club has asked me to setup a relatively simple Access database where those that will use it have very little experience. I am not sure how to setup the following: The ClientTbl has a field, Ad. There is a table, AdTble with the following fields:

Primary key: AutoIncrementing
Description: text (30)
Amount: integer (dollar)

I would like to have a dropdown that shows the description, and when selected, the link to the Primary Key is inserted in the field, Ad. Can this be done? Will the Amount show?

View 1 Replies View Related

LookUp Tables For Dynamic Set Of Attributes: Set A Pointer Or Use A Generic LookUp?

Jul 24, 2007

I'm wrestling with the issues; in other threads, it became apparent that because I could not know ahead of time what I will need to know about a given entity, I will use a table to enumerate attributes that is applicable for a given entity.

However, the stumper is that what if an attribute should conform to a set list of values? Since they are dynamic, I would have problem predicting what I will need to be able to lookup, and am even don't know whether I will need a one-many lookup or many-many lookup.

I thought that generic lookup table with a table listing "classes" of lookup would allow me to have one big generic lookup table while using "classes" to act like virtual tables so I can then set the query to appropriate "class" to return just right set of values.

But as I thought about it, I ran into some issues which is pulling me toward the crazy idea that I should have freestanding tables, and use a field in tblAttribute to give me the table's name so I'd know which free-standing table it points to, and have the necessary key to lookup the values within that table.

Even though my gut instincts tell me that I shouldn't be going against the conventions of database design (who the frick goes around creating free-standing lookups?!?), I'm simply not sure how I can use a generic lookup table to hold all information.

For example, suppose I was given a list of values that has its own categories. Since the former design allows only for two level (lookup and lookupclass), where am I to insert that extra level?

Furthermore, I found myself needing a set of virtual keys to reference a certain "class" of lookups for report purposes. That means I need an extra field in my lookup table than I originally anticipates. What if I find myself needing one more field that just won't fit the generic lookup table?

So does anyone have suggestions on how we would create a placeholder for a lookup table that will be made just in time?

View 4 Replies View Related

Table Lookup Function

Mar 21, 2005

Hi,

I have a table with the following 3 fields (these are the ones i'm having the issue with but there are others).

ID, Country, City

The ID is an auto number.

The Country Field is a lookup with the following lookup properties

Display Control: Combo Box

Row Source Type: Value List

Row Source: "England";"Spain";"France" etc


:confused: Now the problem...

I also want a lookup in the City field which changes to reflect what was selected in the Country field.

E.G

If in the Country Field Spain is selected then in the City Field I should have the option of selecting Barcelona, Madrid, Valencia etc.

Is this possible in the lookup of a table???


Thanks. :)

View 4 Replies View Related

Field & Lookup Table

Jan 6, 2006

I am very new to Access and any help would be appreciated. I have been through the entire Access Bible and many forums but can't find the answer to my specific question.

The project:

I'm setting up a database for tutors and students. Tutors will, via the web, enter data about a specific tutoring session (studentName, subject, sessionLength, etc.) Then at the end of the month a report will be generated detailing hours tutored and total compensation.

The problem:

Students pay varying rates based on subject (math or verbal). So in the Session table each record for each tutoring session has an empty field called payRate. This is the rate the student will pay based on subject. So I need this field to "fill in" automatically based on the 'student' and the 'subject' from the same record. Then I can multiply the field by sessionLength and get a totalPay field for the session. Add these at month's end and pay the tutors.

I've set up a lookup table called 'subject' with three fields (student,subject, payRate) and I have the student and subject combined as the primary key. Am I on the right track here? If so, how do I link the tables to get that Session 'payRate' field to fill in automatically. This is where is breaks down for me. I've tried the lookup wizard but all I seem to get when I open the Session table is an empty PayRate field with a drop down box containing the entire subject lookup table.

Sorry for being so long winded but I need help from someone better at his than me. Thanks in advance.

View 2 Replies View Related

Lookup Table - Numbers?

Mar 9, 2006

Hi all,
I Have a question regarding lookup tables. I have a table called tblActivities. In this, I have created a field called ActivityBudget. I would like this to be a lookup field (select entries from a list). In order to do this, I have created a table called tblBudgetLists with all the various budgets. For the AcitvityBudget field in tblActivities, I have set it as Text with the following things:

Display Control: Combo Box
Row Source Type: Table/Query
Row Source: tblBudgetLists
Limit To List: Yes

The function is half working... There are 19 entries in the tblBudgetLists table. When I select a budget from the list in tblActivities.ActivityBudget, the numbers 1 to 19 are displayed (I am assuming because there are 19 entries), rather than the names of the budgets. Any ideas on how to change this?

sugar05

View 1 Replies View Related

If A AND B Then C Lookup Table Needed

Oct 30, 2006

I am looking to set up tables in such a way that will allow for the concept:
If Variable 1=A and Variable 2=B then Output of 3=C

For Example:
If the House is "Blue"
And the Man drinks "Beer"
Then his pet is a "Dog"

If the House is "Green"
And the Man drinks "Vodka"
Then his pet is a "Bird"

NOTE:
There is no equational relationship between the first two variables to get the 3rd output. It is simply a lookup table. In excel you would have the color house down the left, the drink across the top and in the cells would be the type of pet. But I am struggling with how this can be made to function within Access since I will want the user to obviously be able to pick the first two variables and have the "answer" spit out.

View 2 Replies View Related







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