Basis Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In short; I have a table in my database that is not related to any other
table(s).

I would like to pull data into a form from that table. That table is not
part of the form query. Can I use the Dlookup function for this?
 
Okay, I think I almost have this working. What is wrong with below syntax as
I keep getting an error:

=DLookUp("[Set]","Sunrise Sunset","DaylightId= DatePart("y",Now())")

The --DatePart("y",Now())--is the problem as I can get it to work without
that piece if I simply plug in the number.
 
Try DatePart("y",Date)

--
hth,
SusanV


DavidSt said:
Okay, I think I almost have this working. What is wrong with below syntax
as
I keep getting an error:

=DLookUp("[Set]","Sunrise Sunset","DaylightId= DatePart("y",Now())")

The --DatePart("y",Now())--is the problem as I can get it to work without
that piece if I simply plug in the number.

DavidSt said:
In short; I have a table in my database that is not related to any other
table(s).

I would like to pull data into a form from that table. That table is not
part of the form query. Can I use the Dlookup function for this?
 
Put the DatePart function outside of the quotes, so that it gets
evaluated...

=DLookUp("[Set]","Sunrise Sunset","DaylightId= " & DatePart("y",Now()))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


DavidSt said:
Okay, I think I almost have this working. What is wrong with below syntax as
I keep getting an error:

=DLookUp("[Set]","Sunrise Sunset","DaylightId= DatePart("y",Now())")

The --DatePart("y",Now())--is the problem as I can get it to work without
that piece if I simply plug in the number.

DavidSt said:
In short; I have a table in my database that is not related to any other
table(s).

I would like to pull data into a form from that table. That table is not
part of the form query. Can I use the Dlookup function for this?
 
Marvelous. Thank you!

Douglas J Steele said:
Put the DatePart function outside of the quotes, so that it gets
evaluated...

=DLookUp("[Set]","Sunrise Sunset","DaylightId= " & DatePart("y",Now()))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


DavidSt said:
Okay, I think I almost have this working. What is wrong with below syntax as
I keep getting an error:

=DLookUp("[Set]","Sunrise Sunset","DaylightId= DatePart("y",Now())")

The --DatePart("y",Now())--is the problem as I can get it to work without
that piece if I simply plug in the number.

DavidSt said:
In short; I have a table in my database that is not related to any other
table(s).

I would like to pull data into a form from that table. That table is not
part of the form query. Can I use the Dlookup function for this?
 
Back
Top