G
Guest
how can i add the result of a query that my report is not based on into the
report header
report header
=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
[Forms]![frmfinalreport]!Years)
The Uke said:still getting a syntax error
=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
I changed # to Num and year to years
Double checked the spelling and still
Klatuu said:I thought this was for the header of a report?
If so, it goes on the report in the Control Source property of a text box.
If the year value is on an open form, then you need to fully qualify the
reference
Couple of points
# should not be used in names
Year is a reserved word in Access and will cause problems when used as a name.
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays", "[Year] = " &
[Forms]![frmfinalreport]!txtTheYear)
--
Dave Hargis, Microsoft Access MVP
The Uke said:tablename is #ofworkdays
the fields are Year, Workdays
Query name is qry#ofworkdays
sql view of query
SELECT [#ofworkdays].Workdays
FROM [#ofworkdays]
WHERE ((([#ofworkdays].Year)=[Forms]![frmfinalreport]![year]));
so as far is i under stand it will look something like this
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays",
"[Year] = " & Me.txtTheYear)
puting this in the form didn't work I get a syntax error
Question? does this need to change Me.txtTheYear
:
Actually, you can return both with the DLookup
=DLookup("[TheYearField] & " - " & "[TheDaysField]", "TheTableName",
"[TheYearField] = " & Me.txtTheYear)
Put the year in a text box on your report or you can refer to it on a form
is the form is open.
--
Dave Hargis, Microsoft Access MVP
:
I have a unbound txt box with the year in a form attached to a query as a
critria the result of the query is the number of days avabiable to work in
that year
which is located in the table that has the year and the #of days
:
How many rows and columns do you expect the query to return?
--
Dave Hargis, Microsoft Access MVP
:
how can i add the result of a query that my report is not based on into the
report header
The Uke said:good catch the syntax is right but the number is wrong. The number that is
displaying is 797 but it needs to be 1210 i have no clue what hole it is
pulling that number out of
Klatuu said:Missing a Quote Mark
v=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
=DLookup("[Years]" & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &[Forms]![frmfinalreport]!Years)
--
Dave Hargis, Microsoft Access MVP
The Uke said:still getting a syntax error
=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
I changed # to Num and year to years
Double checked the spelling and still
:
I thought this was for the header of a report?
If so, it goes on the report in the Control Source property of a text box.
If the year value is on an open form, then you need to fully qualify the
reference
Couple of points
# should not be used in names
Year is a reserved word in Access and will cause problems when used as a name.
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays", "[Year] = " &
[Forms]![frmfinalreport]!txtTheYear)
--
Dave Hargis, Microsoft Access MVP
:
tablename is #ofworkdays
the fields are Year, Workdays
Query name is qry#ofworkdays
sql view of query
SELECT [#ofworkdays].Workdays
FROM [#ofworkdays]
WHERE ((([#ofworkdays].Year)=[Forms]![frmfinalreport]![year]));
so as far is i under stand it will look something like this
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays",
"[Year] = " & Me.txtTheYear)
puting this in the form didn't work I get a syntax error
Question? does this need to change Me.txtTheYear
:
Actually, you can return both with the DLookup
=DLookup("[TheYearField] & " - " & "[TheDaysField]", "TheTableName",
"[TheYearField] = " & Me.txtTheYear)
Put the year in a text box on your report or you can refer to it on a form
is the form is open.
--
Dave Hargis, Microsoft Access MVP
:
I have a unbound txt box with the year in a form attached to a query as a
critria the result of the query is the number of days avabiable to work in
that year
which is located in the table that has the year and the #of days
:
How many rows and columns do you expect the query to return?
--
Dave Hargis, Microsoft Access MVP
:
how can i add the result of a query that my report is not based on into the
report header
Klatuu said:Missing a Quote Mark
v=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
=DLookup("[Years]" & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &[Forms]![frmfinalreport]!Years)
--
Dave Hargis, Microsoft Access MVP
The Uke said:still getting a syntax error
=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
I changed # to Num and year to years
Double checked the spelling and still
Klatuu said:I thought this was for the header of a report?
If so, it goes on the report in the Control Source property of a text box.
If the year value is on an open form, then you need to fully qualify the
reference
Couple of points
# should not be used in names
Year is a reserved word in Access and will cause problems when used as a name.
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays", "[Year] = " &
[Forms]![frmfinalreport]!txtTheYear)
--
Dave Hargis, Microsoft Access MVP
:
tablename is #ofworkdays
the fields are Year, Workdays
Query name is qry#ofworkdays
sql view of query
SELECT [#ofworkdays].Workdays
FROM [#ofworkdays]
WHERE ((([#ofworkdays].Year)=[Forms]![frmfinalreport]![year]));
so as far is i under stand it will look something like this
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays",
"[Year] = " & Me.txtTheYear)
puting this in the form didn't work I get a syntax error
Question? does this need to change Me.txtTheYear
:
Actually, you can return both with the DLookup
=DLookup("[TheYearField] & " - " & "[TheDaysField]", "TheTableName",
"[TheYearField] = " & Me.txtTheYear)
Put the year in a text box on your report or you can refer to it on a form
is the form is open.
--
Dave Hargis, Microsoft Access MVP
:
I have a unbound txt box with the year in a form attached to a query as a
critria the result of the query is the number of days avabiable to work in
that year
which is located in the table that has the year and the #of days
:
How many rows and columns do you expect the query to return?
--
Dave Hargis, Microsoft Access MVP
:
how can i add the result of a query that my report is not based on into the
report header
Klatuu said:I thought this was for the header of a report?
If so, it goes on the report in the Control Source property of a text box.
If the year value is on an open form, then you need to fully qualify the
reference
Couple of points
# should not be used in names
Year is a reserved word in Access and will cause problems when used as a name.
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays", "[Year] = " &
[Forms]![frmfinalreport]!txtTheYear)
--
Dave Hargis, Microsoft Access MVP
The Uke said:tablename is #ofworkdays
the fields are Year, Workdays
Query name is qry#ofworkdays
sql view of query
SELECT [#ofworkdays].Workdays
FROM [#ofworkdays]
WHERE ((([#ofworkdays].Year)=[Forms]![frmfinalreport]![year]));
so as far is i under stand it will look something like this
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays",
"[Year] = " & Me.txtTheYear)
puting this in the form didn't work I get a syntax error
Question? does this need to change Me.txtTheYear
Klatuu said:Actually, you can return both with the DLookup
=DLookup("[TheYearField] & " - " & "[TheDaysField]", "TheTableName",
"[TheYearField] = " & Me.txtTheYear)
Put the year in a text box on your report or you can refer to it on a form
is the form is open.
--
Dave Hargis, Microsoft Access MVP
:
I have a unbound txt box with the year in a form attached to a query as a
critria the result of the query is the number of days avabiable to work in
that year
which is located in the table that has the year and the #of days
:
How many rows and columns do you expect the query to return?
--
Dave Hargis, Microsoft Access MVP
:
how can i add the result of a query that my report is not based on into the
report header
The Uke said:I figure were its coming from well kinda Year - workdays 2007 - 1210 = 797
Klatuu said:Missing a Quote Mark
v=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
=DLookup("[Years]" & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &[Forms]![frmfinalreport]!Years)
--
Dave Hargis, Microsoft Access MVP
The Uke said:still getting a syntax error
=DLookup("[Years] & " - " & "[Workdays]", "Numofworkdays", "[Years] = " &
[Forms]![frmfinalreport]!Years)
I changed # to Num and year to years
Double checked the spelling and still
:
I thought this was for the header of a report?
If so, it goes on the report in the Control Source property of a text box.
If the year value is on an open form, then you need to fully qualify the
reference
Couple of points
# should not be used in names
Year is a reserved word in Access and will cause problems when used as a name.
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays", "[Year] = " &
[Forms]![frmfinalreport]!txtTheYear)
--
Dave Hargis, Microsoft Access MVP
:
tablename is #ofworkdays
the fields are Year, Workdays
Query name is qry#ofworkdays
sql view of query
SELECT [#ofworkdays].Workdays
FROM [#ofworkdays]
WHERE ((([#ofworkdays].Year)=[Forms]![frmfinalreport]![year]));
so as far is i under stand it will look something like this
=DLookup("[Year] & " - " & "[Workdays]", "#ofworkdays",
"[Year] = " & Me.txtTheYear)
puting this in the form didn't work I get a syntax error
Question? does this need to change Me.txtTheYear
:
Actually, you can return both with the DLookup
=DLookup("[TheYearField] & " - " & "[TheDaysField]", "TheTableName",
"[TheYearField] = " & Me.txtTheYear)
Put the year in a text box on your report or you can refer to it on a form
is the form is open.
--
Dave Hargis, Microsoft Access MVP
:
I have a unbound txt box with the year in a form attached to a query as a
critria the result of the query is the number of days avabiable to work in
that year
which is located in the table that has the year and the #of days
:
How many rows and columns do you expect the query to return?
--
Dave Hargis, Microsoft Access MVP
:
how can i add the result of a query that my report is not based on into the
report header
Klatuu said:How many rows and columns do you expect the query to return?