Database Administrators
Q&A for database professionals who wish to improve their database skills
Latest Questions
0
votes
1
answers
223
views
Setting up relationships properly with the Access UI
I am making the database design of my website in Microsoft Access 2013 because it has a nice user interface and I believe it will help me understand everything a whole lot better with the UI. I have to create a relationship between two fields in one table with one field in the other - have I done th...
I am making the database design of my website in Microsoft Access 2013 because it has a nice user interface and I believe it will help me understand everything a whole lot better with the UI.
I have to create a relationship between two fields in one table with one field in the other - have I done this correctly (please see the screen capture below)? If not, what would I do to correct my errors?
Thanks in advance.

Josh Murray
(101 rep)
Jan 2, 2016, 11:42 PM
• Last activity: Jun 12, 2025, 09:02 PM
0
votes
1
answers
269
views
How to Stop MS Access From Undesired Cascading Delete?
When I delete a record from one Microsoft Access table, it deletes the corresponding record in another table. I need to stop that. 1. Table 'items' has ID (the key), item_name, and some other fields. 2. Table 'special_order_item' has 'item' (the key), quantity, and some other fields. 3. special_orde...
When I delete a record from one Microsoft Access table, it deletes the corresponding record in another table. I need to stop that.
1. Table 'items' has ID (the key), item_name, and some other fields.
2. Table 'special_order_item' has 'item' (the key), quantity, and some other fields.
3. special_order_item.item is an Access Lookup field, with Row Source:
ID, item_name FROM items;
There is no relationship between the tables defined in Access.
The apparent cascaded delete happens only when I use the GUI to select the record in special_order_items and press the Delete key. If I enter and run a SQL delete statement, the record is deleted from 'special_order_items' without impacting 'items'.
It happens only when the Row Source is a SQL query (e.g. a SELECT statement); not when the row source is a table.
My intent is that a special_order_items record must have an 'item' drawn from items. 'items' is my list of things which can be special-ordered. Deleting a special-order should not delete the item from the orderables - just from special-order.
Kevin Kleinfelter
(121 rep)
Jul 17, 2021, 02:35 PM
• Last activity: Jul 17, 2021, 04:44 PM
1
votes
1
answers
1366
views
Access Macro: ApplyFilter w/values from 2 combo boxes
I'm getting started with databases in Access for a work project (technically a work-learn for my non-CompSci degree). I have experience using multiple filters on multiple columns through Access/Excel, but for my work learn I'm trying to design an interface with some "quick filter" functionality buil...
I'm getting started with databases in Access for a work project (technically a work-learn for my non-CompSci degree). I have experience using multiple filters on multiple columns through Access/Excel, but for my work learn I'm trying to design an interface with some "quick filter" functionality built into the UI. Since I'm pretty green, I'm using macros instead of VBA which seems to be doing the job fine... But I've hit a snag, and was hoping y'all might be able to help?
I have a split-view form with top containing record details and quick search options, and the bottom containing the table itself as filtered (which serves as a list of results). What I'm trying to do is filter a column by the selections from two dropdowns on a form.
I was able to do this by doing:
ApplyFilter WHERE Table!Articles!IntCodes LIKE "*"IntCombo1 & "*" & IntCombo2 "*"
But then I realized that while that will find entries where IntCombo1 and IntCombo2 appear *in order,* (e.g. Dog, Cat) it won't show ones where they appear reversed (Cat, Dog).
I *would think* that the way to fix that would be one of:
ApplyFilter WHERE Table!Articles!IntCodes LIKE "*"IntCombo1 & "*" & IntCombo2 "*" OR "*"IntCombo2 & "*" & IntCombo1 "*"
or
ApplyFilter WHERE Table!Articles!IntCodes LIKE ("*"IntCombo1 & "*" & IntCombo2 "*") OR ("*"IntCombo2 & "*" & IntCombo1 "*")
or
ApplyFilter WHERE Table!Articles!IntCodes LIKE ("*"IntCombo1 & "*" & IntCombo2 "*" OR "*"IntCombo2 & "*" & IntCombo1 "*")
But none of these work, and I'm not sure why because they all seem pretty boolean-ly sound. Can someone tell me what I'm doing wrong?
(Other perhaps relevant info is that the entries on the table I'm filtering are short text words/phrases separated by semicolons ("Dog; Cat; Mouse; Horse", "Mouse", "Cat; Dog", etc...). I totally own that this should probably be converted into a table (long term goal), but the dataset was created over 5 years in an Excel spreadsheet, and therefore is a beast so I haven't gotten around to doing that yet.)
pmusser
(121 rep)
May 26, 2017, 06:33 PM
• Last activity: Oct 14, 2020, 12:02 PM
1
votes
0
answers
129
views
MS Access: automatic creation of row in a table based on field in another table
I have a Table A with an `ID` field and a `Question` field. The question has a yes/no answer. I want MS Access to automatically create a new observation (row) in another table, Table B, if I answer yes. How do I do this? Ideally, I would also like the link between the two tables to be the 'ID' field...
I have a Table A with an
ID
field and a Question
field. The question has a yes/no answer.
I want MS Access to automatically create a new observation (row) in another table, Table B, if I answer yes. How do I do this?
Ideally, I would also like the link between the two tables to be the 'ID' field, which is the primary key of Table A.
This question is vaguely similar, but is not in MS Access.
Emilie
(111 rep)
Sep 15, 2017, 06:39 PM
• Last activity: Sep 15, 2017, 06:43 PM
4
votes
1
answers
103
views
Fill percentage of total field conditional on some other field with MS Access SQL
This question is an extension of [Fill percentage of total field with MS Access SQL](https://dba.stackexchange.com/questions/156749/fill-percentage-of-total-field-with-ms-access-sql). I have the following 2013 MS Access SQL query: UPDATE MyTable SET F = f / DSUM("f", "MyTable") ; This query fills fi...
This question is an extension of [Fill percentage of total field with MS Access SQL](https://dba.stackexchange.com/questions/156749/fill-percentage-of-total-field-with-ms-access-sql) .
I have the following 2013 MS Access SQL query:
UPDATE MyTable
SET F = f / DSUM("f", "MyTable") ;
This query fills field
F
with the percentage over the total of some field f
, such that each one of the records F(i)
in field F
is given by:
F(i) = f(i)/SUM_i(f(i))
Both fields f
and F
belong to table MyTable
.
Now, I would like, instead of simply computing the percentage over the whole table, to do it by Date
, where Date
is a 3rd field also to be found in table MyTable
. I will make up an example for illustration purposes. Let's assume a simplified MyTable
with 2 records per date; then that's what I would like MyTable
to look like after executing my desired query... - see fields f
and F
:
| Date | Department | f | F |
|------------|------------|-----------|-----------|
| t1 | D1 | 2 | 40% |
| t1 | D2 | 3 | 60% |
| t2 | D1 | 1 | 20% |
| t2 | D2 | 4 | 80% |
... And this is how it is looking right now, after executing the query displayed above:
| Date | Department | f | F |
|------------|------------|-----------|-----------|
| t1 | D1 | 2 | 20% |
| t1 | D2 | 3 | 30% |
| t2 | D1 | 1 | 10% |
| t2 | D2 | 4 | 40% |
I have tried the following code, but none yielded what I wanted.
_Try #1_:
UPDATE MyTable
SET F = f / DSUM("f", "MyTable", "Date");
_Try #2_:
UPDATE MyTable
SET F = f / DSUM("f", "MyTable", "Date=Date");
Any ideas on how I could manage to do this?
**Note**: I have just called the two fields "f
" and "F
" here for illustration purposes, it is not how they are named in the actual DB.
----------
I will add here further tests that haven't worked out:
_Try #3_:
UPDATE MyTable
SET F = f / DSUM("f", "MyTable", "Date=" & Date);
_Try #4_: this has worked but only for a single Date
, the 1st one to be recorded - i.e. the one in the 1st row/record of the table MyTable
- for the rest of dates the value for F
is empty.
UPDATE MyTable
SET F = f / DSUM("f", "MyTable", "Date=#" & Date & "#");
Daneel Olivaw
(173 rep)
Nov 30, 2016, 04:30 PM
• Last activity: Dec 1, 2016, 07:52 PM
2
votes
1
answers
197
views
Fill percentage of total field with MS Access SQL
I am trying to fill, with a SQL query, a field `F` with the percentage over the total of some field `f`, such that each record `F(i)` in field `F` is given by: F(i) = f(i)/SUM_i(f(i)) Both fields `f` and `F` and located in a table `MyTable`. I am however struggling to develop a query which manages t...
I am trying to fill, with a SQL query, a field
F
with the percentage over the total of some field f
, such that each record F(i)
in field F
is given by:
F(i) = f(i)/SUM_i(f(i))
Both fields f
and F
and located in a table MyTable
.
I am however struggling to develop a query which manages to do this. My try was:
INSERT INTO MyTable (F)
SELECT f/MyField.fSum
FROM MyTable, (SELECT SUM(f) AS fSum FROM MyTable) AS MyField
But this code inserts new lines in table MyTable
. I don't know how I can proceed from here, as my understanding is that the UPDATE
statement is quite limited and wouldn't be useful for doing this.
Any ideas on how I could manage to do this in the simplest form possible?
I have just called the columns f
and F
here for illustration purposes, it is not how they are named in the actual DB.
Daneel Olivaw
(173 rep)
Nov 30, 2016, 10:34 AM
• Last activity: Nov 30, 2016, 02:50 PM
0
votes
2
answers
49
views
Make custom query from two table access
I have two table that table 1 contains Number, code, ID and table 2 contains Name, Family name, Number, ID, code, Phone number,... Now I want to make a query that contains table 2 fields but the query should check that if for example table2 contains table1.Number, show the table 2 fields that contai...
I have two table that table 1 contains Number, code, ID and table 2 contains Name, Family name, Number, ID, code, Phone number,...
Now I want to make a query that contains table 2 fields but the query should check that if for example table2 contains table1.Number, show the table 2 fields that contains Table1.Number and if table2 doesn't contains the Table1.Number, show the table 2 fields but just fill the fields that table1 and table 2 have them and just for example put "-" in the filed Phone number because table1 doesn't has that but it has code field and table 2 has it too so it should be fill it with the table 1 parameter
And this proccess should be continue for all of the codes of table 1
For example:
Table1 has this data
Table 2 data
Query example:
Can someone help me with this please?



Seena Fallah
(113 rep)
Aug 18, 2016, 07:18 PM
• Last activity: Nov 29, 2016, 06:29 PM
1
votes
1
answers
331
views
How to simplify this query?
I am somewhat new to Access and I need help with a query that Access does not execute because of `Not enough space on temporary disk`. I have one table. A product may have up to 3 IDs and a place to sell. If there is a place to sell, the name will be shown along with a combined identifier consisting...
I am somewhat new to Access and I need help with a query that Access does not execute because of
Not enough space on temporary disk
.
I have one table. A product may have up to 3 IDs and a place to sell. If there is a place to sell, the name will be shown along with a combined identifier consisting of the three IDs plus the *"k1"* prefix. An example of the resulting combined identifier would be *"k1 3232 232 1231233"* (if it has three IDs).
The column names are *ProductID1*, *ProductID2*, *ProductID3*, *Place1*.
This is the query:
SELECT DISTINCT IIf(IsNull([Tam_Liste]![Place1]),"","k1 " & [Tam_Liste]![ProductID1] & " " & [Tam_Liste]![ProductID2] & " " & [Tam_Liste]![ProductID3]) AS item_sku, Tam_Liste.[Place1]
FROM Tam_Liste;
Gary
(11 rep)
Aug 16, 2016, 01:44 AM
• Last activity: Aug 16, 2016, 08:45 AM
Showing page 1 of 8 total questions