Returning Null with Dlookup

K

Keri

Hi I was if some one might explain this further I have an event using dlookup
but I'm returning a null. Here is the code.
REMS_Number = DLookup("[Rems Number]", "tblProperties", "[PropertiesID]=" &
[propertiesid])

Any assitance would be helpful.
thanks you very much.
Keri
 
K

Keith Wilby

Keri said:
Hi I was if some one might explain this further I have an event using
dlookup
but I'm returning a null. Here is the code.
REMS_Number = DLookup("[Rems Number]", "tblProperties", "[PropertiesID]="
&
[propertiesid])

Any assitance would be helpful.
thanks you very much.
Keri

What do you want it to return if it evaluates to null? You can use the
null-to-zero function (Nz) to get it to return something other than null, is
that what you want?

Keith.
www.keithwilby.co.uk
 
K

Keri

I have a mail tracking log that i'm using. I want to fill certain parts of a
new record so I wouldn't have to enter the infomration into to two table.
That is why I wanted to use dlookup on my form.

Keith Wilby said:
Keri said:
Hi I was if some one might explain this further I have an event using
dlookup
but I'm returning a null. Here is the code.
REMS_Number = DLookup("[Rems Number]", "tblProperties", "[PropertiesID]="
&
[propertiesid])

Any assitance would be helpful.
thanks you very much.
Keri

What do you want it to return if it evaluates to null? You can use the
null-to-zero function (Nz) to get it to return something other than null, is
that what you want?

Keith.
www.keithwilby.co.uk
 
J

John W. Vinson

Hi I was if some one might explain this further I have an event using dlookup
but I'm returning a null. Here is the code.
REMS_Number = DLookup("[Rems Number]", "tblProperties", "[PropertiesID]=" &
[propertiesid])

Any assitance would be helpful.
thanks you very much.
Keri

If you're returning a NULL, that means that either there is a NULL value for
Rems Number in tblProperties, or that there is no record in tblProperties for
the selected propertiesid. What value do you WANT Access to return in such a
case? You can't look up what isn't there!
 
K

Keri

Hello Mr. Vinson,
I am tracking mail. I am trying to create an event after update of the
Property Name that the the REMS Number, FHA Number, Contract Number and
Project Manager populate from another table. I dont not want to have to enter
data repeatly for each new record. I have found the mircsoft web page on the
northwinds example for the dlookup. There are records in the REMS Number
field etc. I have modified my code to REMS_Number = DLookup("[REMS Number]",
"tblTracking Log", "[Tracking Log ID] =" & [Tracking Log ID])
since I'm using a form. I am not getting an returns for it when I enter a
new record for a property. I am very fustratrated. I didn't think something
this simple would be so hard. Any help you give will be greatly appreciated.

Thanks,
Keri


John W. Vinson said:
Hi I was if some one might explain this further I have an event using dlookup
but I'm returning a null. Here is the code.
REMS_Number = DLookup("[Rems Number]", "tblProperties", "[PropertiesID]=" &
[propertiesid])

Any assitance would be helpful.
thanks you very much.
Keri

If you're returning a NULL, that means that either there is a NULL value for
Rems Number in tblProperties, or that there is no record in tblProperties for
the selected propertiesid. What value do you WANT Access to return in such a
case? You can't look up what isn't there!
 
J

John W. Vinson

Hello Mr. Vinson,
I am tracking mail. I am trying to create an event after update of the
Property Name that the the REMS Number, FHA Number, Contract Number and
Project Manager populate from another table.

Are you *STORING* these from "another table" into this table? If so, *don't*!
That would be redundant. All that you need to store is the PropertiesID, and
use a query to link them.
I dont not want to have to enter
data repeatly for each new record.

Of course not. But take a step further and don't store them AT ALL.
I have found the mircsoft web page on the
northwinds example for the dlookup. There are records in the REMS Number
field etc. I have modified my code to REMS_Number = DLookup("[REMS Number]",
"tblTracking Log", "[Tracking Log ID] =" & [Tracking Log ID])
since I'm using a form. I am not getting an returns for it when I enter a
new record for a property. I am very fustratrated. I didn't think something
this simple would be so hard. Any help you give will be greatly appreciated.

If you just want to display the REMS Number (or other fields) on a Form, no
code is needed at all, not even DLookUp. Instead just include all of the
fields that you want to display in the Tracking Log ID Combo Box's RowSource;
set the control source of textboxes on the form to

=comboboxname.Column(n)

where n is the *zero based* index of the field that you want to display.

If you have a real, valid need to store the field value, please explain - it
can be done, it just usually should not be done.
 
K

Keri

Hi I guess I should explain more of why I'm using dlookup.
I am tracking mail for my office. I have five fields that are for each
record property name, rems number, fha number, contract number and project
manager. I use these fields everytime I log a new piece of mail and assign
the task. I was using combo boxes for each of the upabove mention fields but
it takes to long plus I dont always have all of the above information when a
letter is log. i just want to save some data entry time. I'm not having much
luck with this. Is dlookup what I shouldn't be trying to use?
thanks,
Keri

John W. Vinson said:
Hello Mr. Vinson,
I am tracking mail. I am trying to create an event after update of the
Property Name that the the REMS Number, FHA Number, Contract Number and
Project Manager populate from another table.

Are you *STORING* these from "another table" into this table? If so, *don't*!
That would be redundant. All that you need to store is the PropertiesID, and
use a query to link them.
I dont not want to have to enter
data repeatly for each new record.

Of course not. But take a step further and don't store them AT ALL.
I have found the mircsoft web page on the
northwinds example for the dlookup. There are records in the REMS Number
field etc. I have modified my code to REMS_Number = DLookup("[REMS Number]",
"tblTracking Log", "[Tracking Log ID] =" & [Tracking Log ID])
since I'm using a form. I am not getting an returns for it when I enter a
new record for a property. I am very fustratrated. I didn't think something
this simple would be so hard. Any help you give will be greatly appreciated.

If you just want to display the REMS Number (or other fields) on a Form, no
code is needed at all, not even DLookUp. Instead just include all of the
fields that you want to display in the Tracking Log ID Combo Box's RowSource;
set the control source of textboxes on the form to

=comboboxname.Column(n)

where n is the *zero based* index of the field that you want to display.

If you have a real, valid need to store the field value, please explain - it
can be done, it just usually should not be done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top