Microsoft Access
--
Questions
--
Followers
Top Experts
I need the student refernce numbers displayed in a text field (set to datasheet view) . They are currently stored in table UNITE_CAPD_STUDENT where the E_REFERENCE stored in table UNITE_CAPD_MODULEENROLMENT
question.JPG
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
=DLookUp("E_ID","UNITE_CAP
but when it just produces the error '#Name?' am i calling the combo box correctly?
It would be well worth double-checking the spelling too - it has to be EXACTLY right for the DLookup to work.
=DLookup("E_ID", "UNITE_CAPD_MODULEENROLMEN






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
In your case, I guess you should rename 'Combo41' to something like 'cmbReference'.
>>>>>I need the student refernce numbers displayed in a text field (set to datasheet view) . They are currently stored in table UNITE_CAPD_STUDENT where the E_REFERENCE stored in table UNITE_CAPD_MODULEENROLMENT
After reviewing your Query Grid in the picture you attached ..... Unless I'm totally missing your question here seems like all you have to do is replace the Criteria line for the E_REFERENCE field to the following ....
[Forms]![klookup]
Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Originally I got the same impression until I looked at the Criteria line in the Query Grid for the E_REFERENCE field. He has Like "7*" in there which does not make sense if he is using the value of Combo41 to determine which values are selected.
I think he is trying to get the Select Query to return the values from the table based on Combo41. Therefore, he really doesn't need a DLookup.
ET
Thanks for the replies, the E_ID and E_REFERENCE fields do exist within the table.
The E_REFERENCE field contains letters and numbers. So would i need the following?...
=DLookup("E_ID", "UNITE_CAPD_MODULEENROLMEN
and just insert '[Forms]![klookup]





EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
On the Criteria line for the E_REFERENCE field just replace the Like "7*" with [Forms]![klookup]
Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Have I understood your problem correctly?
Thx.
I need the various comments to link to a table called risk, i need to pull other values such as attendance % out of the unit E database. Obv if a lecturer chooses a course from the dropdown box and a student on that course has a comment saved in the table risk then i need it to display and also if there is no comment already entered they need the ability to enter one.
Sorry for the confusion.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Where do you have the DLookup????
ET
21229892 - #Name?

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
=DLookup("E_ID", "UNITE_CAPD_MODULEENROLMEN
This won't give you the right ID value, but at least it will tell you whether E_ID.UNITE_CAPD_MODULEENRO
What happens now?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
So what happend when you tried ID 21230864?

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Now change the Control Source tto:
=DLookUp("E_ID", "UNITE_CAPD_MODULEENROLMEN






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Now change the Control Source to:
=[Combo41]

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Seems to have done the trick.
=DLookup("E_ID", "UNITE_CAPD_MODULEENROLMEN
Private Sub Command40_Click()
On Error GoTo Err_Command40_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "qwerty"
stLinkCriteria = "[E_REFERENCE]=" & "'" & Me![Combo41] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Exit_Command40_Click:
Exit Sub
Err_Command40_Click:
MsgBox Err.Description
Resume Exit_Command40_Click
End Sub






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Assuming I'm right, you're getting the 'Enter Parameter Value' prompt because E_REFERENCE is not one of the fields in the form's Record Source.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
As for your E_REFERENCE problem, (apologies if this is obvious) you'll have to add this field to your form's Record Source if you want to reference it!
Also, what table contains the E_REFERENCE field?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
SELECT *
FROM risk2 JOIN UNITE_CAPD_MODULEENROLMENT
ON UNITE_CAPD_MODULEENROLMENT
Bear in mind that your form will then only display data where corresponding records exist in BOTH tables.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
SELECT UNITE_CAPD_MODULEENROLMENT
FROM risk2 INNER JOIN UNITE_CAPD_MODULEENROLMENT
i dont think the join worked. So plan B was if a table only holds 1 record. This is not the case
Suppose you have a form which you want to use to display Car Types and House Types, and you want to use bound controls to display the data in one record from the Car Types table side-by-side with the data in one record from the House Types table.
Because the two sets of information are entirely unrelated you can't join the correspnding tables and as a result you can't use this approach to display the two sets of data on the same form at the same time.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
On the other hand, you CAN display Chalk in one sub-form and Cheese in a DIFFERENT sub-form of the same parent form but this is NOT displaying the records side-by-side, as the two sub-forms have independent Record Sources.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Sorry, i had to go into a meeting. Im home now but will be looking at this over the weekend and will post again on Monday. Thanks a million for all of your help. On tis site they dont have example databases do they? Do you have any you could upload for meto browse through?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Can you pare down what you've got (including removing any private data), zip it up and upload it as an attached file?
Yes i will try to send you a copy of the database on Monday morning when i get into the office around 8am. As previously discussed my solution is not possible so hopefully we can find a solution that is second best.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Would it be possible to post a 'stand-alone' version?
https://www.experts-exchange.com/questions/23273226/Storing-external-and-local-table-data.html
it may well be impossible to achieve the results you're after using datasheet view
You also should replace 'DoCmd.DoMenuItem' with 'DoCmd.RunCommand' - the former syntax was deprecated in 1997! If I've understood your code correctly these statements, these should read:
DoCmd.RunCommand acCmdSaveRecord
There is also no need for ANY of the 'Me!' or 'Me.' qualifiers when accessing controls on the current form. Finally, you should SERIOUSLY consider replacing the default names given to your controls by Access with names that reflect what they are actually used for - it will make your code a LOT more understandable!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Private Sub Command40_Click()
Dim stDocName As String
Dim stLinkCriteria As String
On Error GoTo Err_Command40_Click
stDocName = "qwerty"
stLinkCriteria = "[E_REFERENCE]=" & "'" & [Combo41] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Exit_Command40_Click:
Exit Sub
Err_Command40_Click:
MsgBox Err.Description
Resume Exit_Command40_Click
End Sub
to just:
Private Sub Command40_Click()
On Error GoTo Err_Command40_Click
DoCmd.OpenForm "qwerty", acFormDS, , "E_REFERENCE = '" & [Combo41] & "'"
Exit Sub
Err_Command40_Click:
MsgBox Err.Description
End Sub
This means that expressions such as '[Forms]![dataentrytest]





EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Thanks.
As for creating a stand-alone database, you should be able to do this by deleting your linked tables and importing them from your back-end database instead. Assuming this works, please reduce the number of records to a small number and check you have no privacy issues before posting the database!
My aplogies if this is deliberate, but you'd also do well to specify the Application Title by selecting Startup from the Tools menu in the Microsoft Access window - doing this will give the right name in the task bar instead of the generic 'Microsoft Access'.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I am going to attempt the above. But if i import the backend tables wont they just become local ones and the example will then become different to my own?
The sample database will however show exactly what you're trying to do - basically, it doesn't matter where the records come from as far as presenting the information on the same form is concerned. To help focus only on the problem at hand please delete the forms, tables and records that do not apply.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Let me know when you have downloaded it and i can take it down

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Private Sub Combo85_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo85], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
You should have:
Private Sub Combo85_AfterUpdate()
' Find the record that matches the control
RecordsetClone.FindFirst "ID = " & Nz([Combo85], 0)
If Not RecordsetClone.NoMatch Then
Bookmark = RecordsetClone.Bookmark
End If
End Sub
You'll need to ripple this change throughout your database.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Combo83
Combo85
Combo89
Command145

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
But what should the Control Source of the following controls be set to, given that the corresponding fields are not returned by the form Record Source:
Form Control
---- -------
fricommentsform Text0
fririskform Combofri
mainform Text75
mainform Text22
mainform Text40
mainform Text42
mainform Text44
mainform Text46
mainform Text146
mainform Text122
moncommentsform Text0
moncommentsform Combo2
monriskform Combo2
qwerty Comments
thucommentsform Text0
thuriskform Combothu
tuecommentsform Text0
tueriskform Combotue
wedcommentsform Text0
wedriskform Combowed






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
fri_grade
mon_grade
per_fri
per_mon
per_thu
per_tue
per_wed
querty
risk3
thu_grade
tue_grade
wed_grade
That was being used to save a record when i was trying to display the records in continuous form view.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Do you have any comments about IDs 21245705 & 21245807 above, or are these issues To Be Defined as well?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
21245807 - No idea. My best guess is that its redundant data from past courses. The UnitE database where that comes from is a huge database/mess that im not currently involved with.
21245735 - See 21245826

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Then when the user clicks 'search' then the qwerty2 (i know, i know, NAMING! lol) form appears with the student PSN numbers of students enrolled on that course. The qwerty2 table is the one i wanted to link to the risk2 table






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Presumably this combo box should just be listing unique values, so there's something wrong with the underlying query used as the Control Source?
Nonetheless, it still seems wrong that your combo box lists repeated values. Any thoughts?

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
SELECT DISTINCT E_REFERENCE
FROM UNITE_CAPD_MODULEENROLMENT
WHERE E_REFERENCE Is Not Null






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Assuming your drop-down should allow the user to pick any distinct non-null E_REFERENCE value from your 'UNITE_CAPD_MODULEENROLMEN
What do you mean when you say changing the Control Source 'broke the drop-down combo'? I realise it's not very helpful but it drops down fine for me!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
SELECT DISTINCT E_REFERENCE FROM UNITE_CAPD_MODULEENROLMENT






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Do you think you may have the wrong end of the stick as to how joins work? Would I a quick recap (particularly regarding catersain-product joins) be worthwhile?
Thanks.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
SELECT *
FROM Table1, Table2
The above example returns EVERY record in Table1 joined to EVERY record in Table2. The number of records returned is therefore the number of records in Table1 multiplied by the number of records in Table2 - hence the word 'product' in the name.
Using this form of query you specify the join criteria via the WHERE clause, like this:
SELECT *
FROM Table1, Table2
WHERE Table1.CommonID = Table2.CommonID
In this latter case, the WHERE clause effectively determines whether a particular Table1/Table2 record combination corresponds to a pair of related records in the two tables. This is precisely the information missing from your 'qwerty2' query - so EVERY combination is returned, hence the multiplicity of records you observe.
Bear in mind also that the records returned by a Cartesian-product join are not updateable - which explains why you can't edit the data.
You'll also have to explain the uniqueness of each table/query - it seems highly suspiciopus to me that there aren't ANY indexes defined in these tables at present.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Now all of the links i have made in queries is just by dragging and dropping betwwen the records which im guessing by fefault makes a 1-1 relationship? Im not sure how to change this to 1-many for example.
Consider ONE record from your 'risk2' table; does it relate to no records, one record or many records in EACH of your 'UNITE_...' tables? You also need to establish whether EACH relationship is mandatory or optional.
When you've answered these two questions for your 'risk2', repeat the process for the three 'UNITE_...' tables in turn - and post your answers here!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Bear in mind that a table can have many unique indexes (not just the primary key) and that each unique index can be composed of a COMBINATION of several fields.
You need to figure out how you want to handle these dodgy records too. For example, you could decide to set invalid values to Null, you could correct the data (if you can actually determine how to do this), perhaps you should delete all records containing invalid data or maybe you just want to ignore all unintelligible data?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I will take all of your above advice and post the results. When you say 'NO unique indexes,' you are referring to primary keys yes? Almost all the Unite tables have primary keys, i have realised that my risk2 table NOW does not have a primary key, i did originally have one but during the ongoing process of trying to get the databas working they seem to have been deleted, i realise the importance of having a primary key so im sure i didnt delete them on purpose but hey!
Thanks again.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Once you've done this, you really should enforce integrity by defining the indexes and relationships in the underlying tables - unless you do this, it will be possible to create 'orphaned' or duplicate records.
As well, it's a LOT easier to query data if you set the 'Allow Zero Length' flag of all your text fields to 'No' and exclusively use Null to represent missing data - otherwise you have to worry about distinguishing Null, empty string and a string of spaces, which almost certainly ALL actually indicate 'no data'.
This doesn't make sense to me, when there are 59931 UNITE_CAPD_STUDENT records but ony 5038 UNITE_T_ATTEND_ALL records in your sample database!






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
It might be a result of your import process, but you seem to have a LOT of garbage data in your tables - unless you have students who live at '9.99000011463742E+14'?! :-)

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
The approach you take needs to consider ACTUAL (not IDEAL) data, In other words, if a particular relationship "should be mandatory" but the data indicates that related records are not always specified in reality, then the relationship is optional.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I will take your points on board and redo it.
Many Thanks.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I think im loseing it. We need qwerty2 to store comments in risk 2 and populate the S_STUDENTREFERENCE field depending on the course selection dropdown on form klookup
Perhaps we should start again from the beginning?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Please don't take this the wrong way, but so far I'm none the wiser as to this information!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
If you don't join to the 'UNIT_T_ATTEND_ALL' table in your 'qwerty2' query you'll return a LOT more records.
Is this REALLY what you want to do?
==========================
'So where should 'Combo41' on your 'klookup' form get the set of course selections from - is this just the distinct 'E_REFERENCE' field values in your 'UNITE_CAPD_MODULEENROLMEN
The combo is getting the E_REFERENCE fields from the query qwerty2 as this filters in the A Level students only hence the like AS* and A2* in the criteria.
==========================
The 'UNITE_CAPD_MODULEENROLMEN
Yes im going to have to as there is no way of linking them so i assume its old data.
==========================
Your 'UNITE_T_ATTEND_ALL' table contains 5038 records, all of which have related records in your 'UNITE_CAPD_STUDENT' table - which contains 59931 records.
If you don't join to the 'UNIT_T_ATTEND_ALL' table in your 'qwerty2' query you'll return a LOT more records.
Is this REALLY what you want to do?.....
It is a good idea to join this table into the query. I cannot see how the table was created (and the unite 'expert' guy that created it only works mon & tue) but it was created recently and i think it was created for the surpose of this database.
==========================
So where should your 'CourseYRClass' query fit in - and what is its purpose?...
When a lecturer selected a class in the dropdown some of the students were appearing multiple times (this unite expert we have hear 2 days a week) said its to do with the way the database works and added that table for me and said it will now only return each student once, it's something to do with tables between tables in unite.
Is that any clearer?
Many Thanks.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Initially answer this question in straight English-language terms ("I get the set of class codes from the ... information") - this should express your requirements in understandable, REAL-WORLD terms. Next, translate this into field/table equivalents ("The ... information is determined from the ... field of the ... table, where .. field values also exist in the ... table ...").
I will wait for your answer before proceeding further.
Essentially i split the query.
Thanks for your unlimited patience and help with this matter. It has been very much appreciated. Im unsure about this whole points system, shall i just click 'accepted solution' on your last post, as u deserve them.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Microsoft Access
--
Questions
--
Followers
Top Experts
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.