Hello:
I am trying to do a Dlookup expression but it is not working. Basically I have 3 cascading combo box, with the first that has the following code set in the afterupdate event: -
'When the Division is selected, the appropriate Working Region list will
-
'display in the drop down list of CboWrkReg
-
-
With Me![cboWrkReg]
-
If IsNull(Me!cboDivision) Then
-
.RowSource = ""
-
Else
-
.RowSource = "SELECT DISTINCT [WrkRegID] " & _
-
"FROM TblJntALL " & _
-
"WHERE [DivisionID]=" & Me!cboDivision
-
-
End If
-
Call .Requery
-
End With
-
-
End Sub
-
-
This works but it is showing the WrkRegID (Num) instead of the WrkRegionName (Text). My table " TblJntALL " is joining my many to many relationships between Division Name and Working Region Name.
How would I get it to display the WrkRegionName if the WrkRegionName is ONLY in my table “tblWrkReg”???
Any help would be great.
Thanks,
Keith.
8 1743 FishVal 2,653
Recognized Expert Specialist
Hi, Keith.
You need to use [TblJntALL] joined with [tblWrkReg]. -
.RowSource = "SELECT DISTINCT tblWrkReg.WrkRegID, " &_
-
"tblWrkReg.WrkRegionName " & _
-
"FROM TblJntALL INNER JOIN tblWrkReg " & _
-
"ON TblJntALL.WrkRegID = tblWrkReg.WrkRegID " & _
-
"WHERE [DivisionID]=" & Me!cboDivision
-
Regards,
Fish
Hello:
I posted the followiing: -
-
Private Sub CboDivision_AfterUpdate()
-
-
'When the Division is selected, the appropriate Working Region list will
-
'display in the drop down list of CboWrkReg
-
-
With Me![cboWrkReg]
-
If IsNull(Me!cboDivision) Then
-
.RowSource = ""
-
Else
-
.RowSource = "SELECT DISTINCT tblWrkRegion.WrkRegID, " & _
-
"tblWrkRegion.WrkRegionName " & _
-
"FROM TblJntALL INNER JOIN tblWrkRegion " & _
-
"ON TblJntALL.WrkRegID = tblWrkRegion.WrkRegID " & _
-
"WHERE [DivisionID]=" & Me!cboDivision
-
End If
-
Call .Requery
-
End With
-
-
End Sub
-
-
But the ID number is still displaying. Any ideas??
Thanks,
Keith
FishVal 2,653
Recognized Expert Specialist
Hi, Keith.
I guess the table field bound to [cboWrkReg] contains values from tblWrkRegion.WrkRegID. Am I right?
If so, then you need a multicolumn combobox.
In design view set the values of [cboWrkReg] properties to the following:
ColumnCount = 2
ColumnWidths = 0;<any non-zero value here>
BoundColumn = 1
Kind regards,
Fish
P.S. Why do you use DISTINCT predicate? Are there duplicated joints in the table?
Fish:
Thanks for getting back to me, I needed to step away to catch the train. Now I am back looking at this problem again. In my Join table I do have multiple entries due to the relationships. That is why I used the select distinct.
I am going to look at the bound properties now.
Thanks,
Keith
Hi, Keith.
I guess the table field bound to [cboWrkReg] contains values from tblWrkRegion.WrkRegID. Am I right?
If so, then you need a multicolumn combobox.
In design view set the values of [cboWrkReg] properties to the following:
ColumnCount = 2
ColumnWidths = 0;<any non-zero value here>
BoundColumn = 1
Kind regards,
Fish
P.S. Why do you use DISTINCT predicate? Are there duplicated joints in the table?
Fish:
You were correct! I set the columncount=2 and boom I saw the names. I never join tables like you did before. Thanks a lot.......
I actually had this working but needed to change my tables since I discovered that 3 of my tables had many to many relationships. When I changed that, then my cascading problems surfaced again. In the past, I never had to create a DB with lots of relationships let alone many to many ones.
Thanks again,
Keith
FishVal 2,653
Recognized Expert Specialist
Hi, Keith.
I would like to pay your attention to what that sounds like a design problem (or maybe not.
..... In my Join table I do have multiple entries due to the relationships. That is why I used the select distinct......
As long as the table implementing many-to-many relationship between two others contains only unique combinations of FKs from that two tables, filtering by one from these FKs will return recordset containing no duplicates of the other FK.
If it is not so, then it may cause many unpredictable faults in future.
To prevent this I'm strongly recommending you to set multifield index ensuring the table to contain only unique combinations of FKs.
Regards,
Fish
Hi, Keith.
I would like to pay your attention to what that sounds like a design problem (or maybe not.....................................
To prevent this I'm strongly recommending you to set multifield index ensuring the table to contain only unique combinations of FKs.
Regards,
Fish
I am new at creating many to many relationships but this DB has put me in that situation. I believe that I have my tables set correctly. I will research multifield indexing but the link did not help me to understand it entirely............
The reality is that I have to move this project forward and I think the relationships are tight but me not being an expert, that might be a bold statement...
FishVal 2,653
Recognized Expert Specialist
I am new at creating many to many relationships but this DB has put me in that situation. I believe that I have my tables set correctly. I will research multifield indexing but the link did not help me to understand it entirely............
The reality is that I have to move this project forward and I think the relationships are tight but me not being an expert, that might be a bold statement...
Index is just a database engine mechanism to "hold inventory" on a table.
One of it aspects useful in your case that it can prevent information duplicating in table.
In table design view - right-click to enter context menu
- choose [Indexes...]
- add to the first column new index name whatever you like
- add to the second column field names expected to be the parts of the index (both FKs)
- set Unique to Yes
- voile, the database engine itself will prevent FK combination duplication, sure you need to remove existing duplicates first
Regards,
Fish
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ronny Sigo |
last post by:
Hello all,
I already put the same question, only now I have more to tell ...
Although I used this code before in the same routine (only the fieldname of
the table differs) ___ at this point in the...
|
by: Tony Williams |
last post by:
I have posted a number of posts in the Access newsgroups concerning my
problem with DLookup. I have had a number of the experts with helpful
suggestions but I still can't get it to work! This is...
|
by: ctyrrell |
last post by:
I have read with interest the many discussions of the 3048 Error:
Cannot open any more databases. I understand how the number of open
Table ID's causes the problem. My question has to do with the...
|
by: Christine Henderson |
last post by:
I have a problem using the above function in the following simplified
circumstance:
In the lookup table called "Klms Travelled" I have 3 fields, eg:
Receiver Name Receiver Suburb ...
|
by: Don Sealer |
last post by:
I've written this expression for a DLookup function. It works almost
alright.
What I'm trying to do is type in a description and the ID field (number)
populates automatically.
It works almost as...
|
by: MLH |
last post by:
DLookup("", "tblPreliminaryVINs",
"=Forms!frmVINODO!SerialNum")
is giving me a Type Mismatch error. That's confusing to me
and I don't know how to circumvent it. The field in...
|
by: chris.thompson13 |
last post by:
I am having a problem setting the criteria part of the DLookup method
correctly and am consequently getting an error message.
I have a database of staff duties, part of which is a query (qryDaily)...
|
by: Don |
last post by:
Can someone help me fix my DLookup problem. I'm far from proficiency with
Access. I've been creating databases for several years for work with the
help of many of you and trial and error.
I have...
|
by: boyleyc |
last post by:
Hi all
the following code works perfectly well. Basically it populates a
series of check boxes on my form, depending on whether dlookup finds an
associated record.
The problem i have is that...
|
by: rleepac |
last post by:
This is a little complicated but I'll do my best to explain. In my db I have a table called L_AgeCorrection which has the following fields: Age, Sex, Frequency, AgeValue
This is a table used to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |