Invald or Primary Key Cannot contain a null value

A

Alex

Can anyone tell me why I might be getting this message when I add the
following code in the AfterUpdate event of one of my 3 primary key fields in
my table called NewParts, which has a left join to the below table
ExcelBRefParts in my query, which is the data source for my form. When I
click Close, I get the message, but all three primary key fields are
complete. Any ideas? Thanks much.

Me.Act_New_Part_Var_Cost = DLookup("[Variable]", "ExcelBRefParts", "[PART#]
= [New Part#] And [AS PART#] = [New Part NHL] And [Model#] = [Model]")
 
B

Barry Gilbert

If you have it working for dates, the only difference is to get your code to
see only the time portion of the control's value. Try using the TimeValue()
function.

Barry
 
A

Alex

Dates? There are no date fields in my form.

Barry Gilbert said:
If you have it working for dates, the only difference is to get your code to
see only the time portion of the control's value. Try using the TimeValue()
function.

Barry

Alex said:
Can anyone tell me why I might be getting this message when I add the
following code in the AfterUpdate event of one of my 3 primary key fields in
my table called NewParts, which has a left join to the below table
ExcelBRefParts in my query, which is the data source for my form. When I
click Close, I get the message, but all three primary key fields are
complete. Any ideas? Thanks much.

Me.Act_New_Part_Var_Cost = DLookup("[Variable]", "ExcelBRefParts", "[PART#]
= [New Part#] And [AS PART#] = [New Part NHL] And [Model#] = [Model]")
 
B

Barry Gilbert

Sorry. Somehow my response to another posting made it to this one.
Multi-tasking seems to be my downfall today.

Barry


Alex said:
Dates? There are no date fields in my form.

Barry Gilbert said:
If you have it working for dates, the only difference is to get your code to
see only the time portion of the control's value. Try using the TimeValue()
function.

Barry

Alex said:
Can anyone tell me why I might be getting this message when I add the
following code in the AfterUpdate event of one of my 3 primary key fields in
my table called NewParts, which has a left join to the below table
ExcelBRefParts in my query, which is the data source for my form. When I
click Close, I get the message, but all three primary key fields are
complete. Any ideas? Thanks much.

Me.Act_New_Part_Var_Cost = DLookup("[Variable]", "ExcelBRefParts", "[PART#]
= [New Part#] And [AS PART#] = [New Part NHL] And [Model#] = [Model]")
 

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