Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am getting this error in VB module: invalid use of null and....

Status
Not open for further replies.

r143r

Programmer
May 19, 2003
11
0
0
US
Hi Everyone,

I am trying to copy a record on the same table using the following code in VB:

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.GoToRecord , , acNew
DoCmd.RunCommand acCmdPaste
DoCmd.RunCommand acCmdPaste

But when I am trying to execute the following code, it copies everything except the order id (which is the primary key in my table) and gives me the following error:

ERROR #: 94
INVALID USE OF NULL

Can anyone help me in solving this error?

Thanks
r143r
 
Invalid use of null - don't ya hate null!!

Its caused by trying to set a value to null, either in the recordset or on a control. As to how you are copying data - not the way I'd do it ... but it is up to you.

Useful function in Access is Nz which replaces null values with a default specified by you. Its probably that a field in the table needs to be set to allow zero length (text fields).


Vince
 
Is there any better way to copy a record in the same table?

Thanks for your help.

r143r
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top