DlookUp Problem using a query

pinkpanther6666

Board Regular
Joined
Feb 13, 2008
Messages
194
Office Version
  1. 365
Platform
  1. Windows
I have a Dlookup problem

Shown below are my query results and my form .... i need to populate the HomeTeam2 Pts column with Total of the corresponding Total from the query

i am using the following in the HomeTeams2 Pts Textbox but i am getting #Error

=DLookUp("[Total]","qryFixDarts","[Week] =" & [Forms]![frmFixtures2]![Week] & " And [Team] =" & [Forms]![frmFixtures2]![HomeTeam2])


WeekTeamTotalCDarts
1TeamA122
1TeamC122
1TeamE
122
qryFixDarts </caption><thead>
</thead><tbody>
</tbody>



WeekHomeTeam2PtsAwayTeam2Pts
1TeamATeamB
1
TeamCTeamD
1TeamETeamF
1TeamGTeamH
1TeamJTeamK
1TeamLTeamM
1TeamNTeamO
1TeamPTeamQ

<caption> frmFixtures2 </caption><thead>
</thead><tbody>
</tbody><tfoot></tfoot>

Could somebody have a look please


Many Thanks



Steve
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Assuming you need single quotes around the text value for Team:
=DLookUp("[Total]","qryFixDarts","[Week] =" & [Forms]![frmFixtures2]![Week] & " And [Team] ='" & [Forms]![frmFixtures2]![HomeTeam2] & "'")
 
Upvote 0
Xenou

Many thanks for your reply


i have copied and pasted your reply and i still get #Error

i think i am resounded to the fact i will have to input this data manually

many thanks again for your help


Cheers


Steve
 
Upvote 0
If week is a text field it would need the single quotes too. All text literal values should be enclosed in quotes. Possibly you can just include the values you want in your query that feeds the form. Not sure why a dlookup is needed here, I guess. In general a dlookup is a select query using a weird function syntax, so as an exercise, write the dlookup as a sql select query (using hard values as needed) -- just to see how it works. Then transform it into a dlookup.
 
Upvote 0
Xenou

Many thanks for your reply

Week is a Long Integer
HomeTeam2 and AwayTeam2 are both Short Text

I will have a go at SQL ( might have to have a quick internet search to do that)

Many Thanks


Steve
 
Upvote 0

Forum statistics

Threads
1,221,808
Messages
6,162,097
Members
451,742
Latest member
JuanMark10

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top