DLookup Function Using Two Combo Boxes As Criteria
Oct 10, 2007
I have a form where I am using two combo boxes the second combo box fields are being based on what is selected from the first comb box. When I enter the DLookup criteria into the text box I am trying to lookup based on the selection of the combo boxes it returns nothing. Here is what my DLookup looks like:
DLookup("[BranchNumber]", "[tblAllADPCoCodes]", "[ADPCompany]= '" & [cboADPCompany] & "' And [LocationNumber]= '" & [cboLocationNo] & "'")
View Replies
ADVERTISEMENT
Jan 31, 2015
I can't seem to get past this expression/criteria problem.
[Actual] is my field I want to grab data from
[L3-4-5] is my main table
[CDATE] is a form control where the user enters a date
[Quarter] is a number field and want it to equal 1
[Partname] is a text field and string it to equal 1
My current expression is:
=DLookUp("ACTUAL","L3-4-5","ID=" & [CDATE] And "[QUARTER]=1" And "[PARTNAME]='1'")
Although my other expression on another form works.In my if code statement I have
Me.DAYS_TRAINED.Value = DLookup("Days", "TRAINED LH A-PILLAR", "ID=" & FTM_NAME)
So I think I don't understand the multiple criteria part.
View 3 Replies
View Related
Aug 14, 2015
I want to result as dlookup function in access 2007, when I use dlookup like this
=DLookUp("GPFDed","[SalaryAll]","[EMPID]='" & ![Cmb_EMPID] & "' And [SalMonth]='" & "Jan" & "' And [Salyear]='" & [me]![Label17].[Caption] & "'")
it gives #Name?
What is the problem and how can i change the label caption to Combo box column 2 value...
View 1 Replies
View Related
Oct 6, 2005
Hi All,
I would like a form (in Access 2000) that allows users to search the database using combo boxes that specify criteria. So, upon load the form would be populated by every record, then as the user begins to make selections using the combo boxes they can narrow the results down to only a few (combo box filters are cascading; each one narrowing the results the other returned). There would also obviously need to be a reset button and 'all' fields in the combo boxes. I have found the code to filter by 1 combo box but if more than 1 is added (obviously) the filter resets to filter only by the current selection. (See the method I used here (http://www.freevbcode.com/ShowCode.asp?ID=4668))
Does anyone know how to bolt these together so they work in sync?
Please be gentle as I've only been learning Access for 2 months and VBA is still very new to me
Thanks,
Bobadopolis
View 3 Replies
View Related
Jul 20, 2007
Let me see if I can explain this.
I have two tables: TblValues and TblLOC.
TblValues is a table of stactic values where I have listed about nine field names with values under each that usually will not change. This way if there is a change to one of the fields later, I can just add it to the table.
Then there is tblLOC. Here I have similar field names that matches each field in tblValues where I can populate them in my form. I have several fields defined as combo boxes. In the properties for each field defined as a combo box, for row source type has Table/Query selected and for the row source I have the following code in the table, which is an example for the field named Profit Code in TblLOC.
SELECT tblValues.ID, tblValues.Pro1Code
FROM tblValues
WHERE (((tblValues.Pro1Code) Is Not Null));
Then I have my form where I have referenced my fields from the tblLOC. In the properties of each combo box, under the tab labeled DATA, the control source has the name of the the combo box field that is in tblLOC, in this case Profit Code.
Everything works fine. The user selects a value from the form and tblLOC is updated. I can create queries without criteria with no problem. However, in a query if I try to add any criteria, even as simple as using "like" to identify a value in a field of the table that has been populated by the combo box, I will get no results. However, if I use the same functionality in a column where a combo box is not used to populate the field, I get the results that I expect.
Here is an example of the SQL in the query that does not work for me that is applied against a field that is a combo box.
SELECT tblLettersOfCredit.[Profit Code]
FROM tblLettersOfCredit
WHERE (((tblLettersOfCredit.[Profit Code]) Like "Misc"));
If I use the same functionality with a field that is not populated by one of the combo boxes then everything works fine.
I am hoping that there's a simple solution for this, maybe syntax due to the use of a combo box or maybe a property that I need to set... So far I have been unsuccessful in finding the answer. If anyone has any ideas on this one, I would certainly appreciate it. Thanks :)
View 6 Replies
View Related
Jan 28, 2008
Hi All,
I am currently having problems with a multiple criteria query with combo boxes (see attached file).
The problem:
- When user defines all 3 criteria (e.g. selects Project: A, Category: Services and Equipment Type: Packages), the query returns a result - no problem here.
- When user defines no fields (i.e. all combo boxes empty), query returns all records - again, not a probelm.
- However, say a user wants to display all records belonging to just Project: A, for example, the query returns no records. Obviously, there a a number of combinations of this (another example would be a user wanting to show records from project: B, with Category: Equipment Type).
I have included the Is Null statement in the query but to no avail. Could anyone advise on a solution based on the attached database. Your help would be greatly appreciated!
Kind regards,
Stephen
View 2 Replies
View Related
Dec 7, 2004
school has thrown me in to a bodemless ms access pit. can do a bit of VB but queries...I´m new to this stuff. i am glad to have found this fine forum.
i have:
-1 table: tblSpeler (65 entries)
-1 form: frmSpeler (already conected to a search query)
-1 search form: frmZoeken
*2 combo boxes: zoektekst (mp3 player make), zoektekst2 (mp3 player type), search button (cmdZoek).
my question:when i select a make, and then the type » i want that the form shows me the mp3 player with the selected make and type.
if more info needed, just ask. thanx
View 8 Replies
View Related
Dec 12, 2004
i have a search form (see atachment1) with 2 combo boxes.
i have a pruduct form that runs on this query:
Code: SELECT * FROM tblSpeler WHERE (((tblSpeler.merk)=forms!frmZoeken!zoektekst1) And ((tblSpeler.type) Like forms!frmZoeken!zoektekst2));
if i start the the product form, it asks me for the make, and then for the player » it finds the right player in the form.
but via my search form it won´t work. it only opens the product form and no records are shown.
so: in the search form, when i select a "make", and then the "type", and then press search. i want it to show the right record in the product form.
+
when i select a make (eg "apple"), i want the type combo box to exclude all the types that are not from apple (eg only: ipod mini, ipod 20gb. right now it´s like in atachment2.
i know this is a common question, been trying to figure it out with a eg database, but i can´t get it done. all help is welcome
thanks,
-d
View 1 Replies
View Related
Nov 20, 2013
I managed to get separate combo boxes to filter out results on a query, however now I have a slightly different problem.
I managed to get the combo boxes to filter records in different query criteria, i.e criteria A for field A, criteria B for field B, etc.
Now I would like to have several combo box filters in one criteria field, however no matter how much I try to move the code about, they either filter out nothing at all, or show up blank records as they're filtering one after the other, i.e filter for A, and then B, which clearly won't work as there will be no B if you've already filtered for A.
The code I'm using in each criteria box is;
Like "*" & [Forms]![MyForm]![Combo1] & "*"
and this works as a single criteria in a single field.
View 5 Replies
View Related
Sep 29, 2014
I have a user form with six different dropdown boxes. I would like to create a query that gets its criteria from users selecting values from one or more of these boxes.
I have tried:
[forms]![frmName]![comboboxname] or [forms]![formName]![comboboxname] is null
in the corresponding query fields and get a "query is too complex" error message, even when only selecting one criteria.
What am I doing wrong?
View 5 Replies
View Related
Jul 10, 2013
Ok so im working in MS Access 2007.
I want to create a query based on 3 combo boxes but have it so that if the field in the second or third combo box is not populated the query still runs.
Right now i have the Criteria set for the three columns that i wish to sort by as seen below.
Column 1
Criteria: [Forms]![Entity Selection Form]![areabox2]
Column 2
Criteria: [Forms]![Entity Selection Form]![devbox2]
Column 3
Criteria: [Forms]![Entity Selection Form]![entitybox2]
This gives me the correct query result but im forced to make a selection from each combo box. Is there a way to progamme it so that if I only make a selection from the first combobox and leave the others blank i can still get results in a query?
View 2 Replies
View Related
Mar 20, 2013
I have a report that gets its data from a query. I need the query to run before the report based on criteria based from two combo boxes on a form.
View 3 Replies
View Related
Jun 14, 2006
Okay, this might be difficult to understand or tough for me to explain properly. Basically it's like this. I choose a cltContactID (a foreign key tied to a main Client's Contact's table). Then, in the next field, I'm choosing a source (for example: General Hospital) that referred the client to my company - call this refSource.
Then, in some cases, or most, I need to identify the person within that refSource that actually did the referring (eg, a Social Worker named Gene). Now I deal with 20+ Hospitals, 30+ Community Centres, 20+ Medical Centres, etc. etc., basically tonne of different sources.
So I would like the combo box, where I choose the person within a refSource that has referred a client, to only list people (or other staff personnel) that are affiliated with that source which I would have identifed one field earlier, rather than having a combo box that could potentially list hundreds and hundreds of names.
It's more complicated than just adding simple criteria in a query and making the combo-box look up that. The criteria must be dynamic; specific to each record.
Any insight?
Thanks,
Watson
I'm using Access2003 with WindowsXP. Thanks.
View 2 Replies
View Related
Dec 3, 2007
Hi guys! Would appreciate any suggestions that people have for my problem. How do you perform calculations in queries between tables? Do you use the DLookup function to update the values in the query, if not how so? I've heard from somewhere it may be useful to use the DLookup function, but i'm not really sure what this is!
Please help!
View 5 Replies
View Related
Jul 12, 2005
I am trying to default a value in a field using the DLOOKUP function. I have attached the database. The Form is FrmDailySalesInput and the field is Trailer. I have set the default value as follows =DLookUp("[Trailer]","TblStoreInfo","[Store]=[TblStoreInfo]! [Store Location]"). I have seen alot of different syntax on this forum for DLOOKUP. I am using Access 2000 presently.
Also I want to default the value in but be able to change it if necessary.
Any Help would be appreciated.
Thank you
Valerie
View 6 Replies
View Related
Sep 13, 2007
I am receiving #Error in my unbound textbox where I am trying to use the DLookup Function to lookup the value that corresponds with "ADPCompany" and "Location Number" fields. Here is what my DLookup Function looks like:
' =DLookup("BranchNo","tblAllADPCoCodes","ADPCompany=" & Forms![frmMarthaPerPayPeriodDeduction]![ADPCompany])&","& DLookup("BranchNo","tblAllADPCoCodes","LocationNumber=" & Forms![frmMarthaPerPayPeriodDeduction]![LocationNo]) '
I'm not sure if I have the right syntax to include to things in the criteria.
View 1 Replies
View Related
Apr 30, 2008
I was wondering if someone could point out what I'm doing wrong...
I have a (parent) form with 2 subforms. I would like the field in one subform to look at the value in the other subform... if that value is null I would like the field to display "N/A" otherwise I want it to perform a DLOOKUP....
I have the following but I'm not sure if I'm referencing the subform field correctly... I keep getting the #Name? when viewing the field from the parent form's display.
=IIf(IsNull(subfrmPROPOSALSetup.Form!LaborCategory 1),"N/A",DLookUp("LaborCategory1","LABOR","ProposalID=" & Forms!frmPROPOSALSetup!ProposalID))
View 2 Replies
View Related
Sep 13, 2007
I am receiving #Error in my unbound textbox where I am trying to use the DLookup Function to lookup the value that corresponds with "ADPCompany" and "Location Number" fields. Here is what my DLookup Function looks like:
=DLookup("BranchNo","tblAllADPCoCodes","ADPCompany='" & Forms![frmMarthaPerPayPeriodDeduction]![ADPCompany]')&","& DLookup("BranchNo","tblAllADPCoCodes","LocationNumber='" & Forms![frmMarthaPerPayPeriodDeduction]![LocationNo]')
I'm not sure if I have the right syntax to include to things in the criteria.
View 9 Replies
View Related
May 26, 2015
In these three formulas for the Ceil tutorial found here:
[URL]
one of the formulas is:
=IIf(IsNull([RoomNumber]),"",DLookUp("RoomType","Rooms","RoomNumber= '" & [RoomNumber] & "'"))
If one were interested in BedType or Rate then simply substitute that term for RoomType.
Now I am somewhat familiar with how DLookUp works. In other words get RoomType from a table Rooms where there is a given RoomNumber.
Where I get confused is the last clause:
"RoomNumber = '" & [RoomNumber] & ""
I realize it is a compound statement hence the &, but it uses two &s and more.
View 7 Replies
View Related
Jan 25, 2015
I have strange issue when creating auto populated text boxes which displays rows from combo boxes.
In one database auto populates works with simple text box Control Source edit "=[ComboName].[Column](NumberOfColumn)".
Somehow same method doesn't wotk in different database: here one time I have to insert VBA code at On change Event:
Me.TextBoxName = Me.ComboName.Column(NumberOfColumn)
And other time it wont work with On change but only with After Update Event (code is same).
Another thing this morning happens was that when I tried to add new record trough form where combo box and tex boxes are located, MS Office suddenly stopped working after selecting combo box selection (with message Microsoft Office has Stopped Working). It is 2013 version.
I got it work after deleting and re-inserting VBA code to autopopulate text box at After Update Event.
View 3 Replies
View Related
Jul 29, 2015
I currently have 3 tables within a database with student details of three different classes. I need to create a user form that has a dropdown box which I can select a student from one of these tables with a number of text boxes below which brings up all the students details, then once the student has been selected and the correct details are shown then I need to create a button which allows me to move that student from one table to another.
View 4 Replies
View Related
Mar 24, 2014
I'm trying to build an database for aircraft operators. I've got the basic tables structure and relationships but I'm stuck on building an search form to filter records by user input.I've got following controls on my form (unbound):
1. AircraftType (combo box) from tblAircrafts
2. CompanyName (combo box) from tblListOfAircraftsOperators
3. TeailNumber (text box) from tblAircraftOperators
4. AirportNameSearch (combo box) from tblAirports
5. PassengersNumber (text box) from tblAircraftOperators
6. ManufactureYear (text box) from tblAircraftOperators
7. SourceSearch (combo box) from tblInfoSource
8. CountrySearch (combo box) from tblCountry
9. CategorySearch (combo box) from tblAircraftCategory
10. EamilToOperator (text box) from tblAircraftOperators
11. InteriorPhoto (Bound object frame) from tblAircraftOperators
12. ExteriorPhot (bound object frame) from AircraftOperators
I need to enable users to search for aircrafts based on those criteria. As I mentioned I'm new to Access and I don't have any advanced coding skills. I have a query build to perform the search and this is the code I've managed to write so far:
SELECT AircraftOperators.RegistrationNumber, AircraftOperators.PassengersNumber, AircraftOperators.ManufactureYear, AircraftOperators.EmailToOperator, AircraftOperators.ExteriorPhoto, AircraftOperators.InteriorPhoto, tblListOfAircraftOperators.OpratorName, tblAircrafts.AircraftType
FROM tblAircrafts INNER JOIN (tblAirports INNER JOIN (AircraftOperators INNER JOIN tblListOfAircraftOperators ON AircraftOperators.CompanyName =
[code]....
View 2 Replies
View Related
Mar 25, 2013
Attached I have a database that I've been working on which has a form called "frmCriteriaSearch". It is based off of the qryCriteriaListBoxUpdate query. I am trying to get the listbox in the second tab of the results section to work. It queries fine for the checkboxes, but I cannot get the comboboxes to affect the query (unless a checkbox has already been selected)
View 6 Replies
View Related
Jul 6, 2005
i am trying to executed q query which has a Nz function. this works fine when exceuted from access. but when i try to executed the same from Vb i get an exception
"Undefined function 'Nz' in expression"
can anyone point out why this is happening? and wts the solution?
thanks in advance
ASMS
View 5 Replies
View Related
Jul 5, 2006
In a form named PRODUCTION there are 3 text box for invoice data: xtype, xserie, xnumber
I need valid this data from the INVOICE table, where its key is a compound key (TPINV+SERINV+NUMINV)
I tried with:
Private Sub xnumber_AfterUpdate()
Dim searchinv as string
searchinv=Dlookup("*","[Invoice]", [tpinv]="& Forms![production].[xtype] and [xserie]= &Forms![production].[xnumber] and "&Forms![xnumber]
If searchinv ="" then
MsgBox ("Invoice doesn't exist'")
Cancel = True
End If
End Sub
... but it doesnt work.
View 1 Replies
View Related
Jun 26, 2007
Hi
I am having a problem with computation of monthly actual generated from the Amount column which is in a purchase order table..... The monthly budget amount is generated in a query named category query... I have computed like Jan Feb Mar till Dec the column fields in the query.... A form named PO form has been created with the category item combo box ....
The problem is when a user selects a combox box he or she is presented with the monthly actual textbox that shows the amount computed( on a fiscal basis(not calendar days)) and that is done by looking up at the date converting into a month and then computing the amount for that particular category item selected...sum done if there was the same category item like repairs and maintenance done for this amount on the same month different date...I need a way to look up at the date convert into a month and then show the sum in the field textbox using the Dlookup function ..>Can this be done??)
Monthly budget I cant figure a way to get the monthly budget by looking up at the date and show the computed amount on a "fiscal basis" since the monthly budget for different months jan feb mar is computed seperately in seperate fields in the query
Please help me!!! this is URGENt!!!
View 3 Replies
View Related