Replacing a date field with null value

AOGFADUGBA

Board Regular
Joined
Sep 30, 2015
Messages
74
Hi all, i have a command button which is meant to replace a number of fields with a null value in a link table.
the problem is all other fields are replaced with the null value except the date field. below is the vba code i used


Private Sub Command501_Click()
Status = "UNPAID"
DeptNo = ""
PVNo = ""
VoteBook_subform2.Form.[Voucher No] = ""
VoteBook_subform2.Form.[RSubHead] = ""
VoteBook_subform2.Form.[Date] = "null"
VoteBook_subform2.Form.[Head] = ""
VoteBook_subform2.Form.
Code:
 = ""
VoteBook_subform2.Form.[Particulars] = ""
VoteBook_subform2.Form.[Payments] = ""
End Sub


i keep getting error from the date field even when i replaced the "null" with "". please what am i doing wrong???
Thanks
 
Last edited:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
none of those are replaced with NULL

an empty string "" is not NULL

if you want to replace with NULL then use NULL

VoteBook_subform2.Form.[RSubHead] = NULL
VoteBook_subform2.Form.[Date] = NULL
and so on
 
Upvote 0
What is the error message you get and when you get the message and click on debug, which line of code is highlighted?
 
Upvote 0
The error message is "you must enter a value in the date field" i think i have located where the error is coming from. the date field is a required field. so i changed required to No and it worked. although i still need to check why i made the Date field in the votebook table a required field.
Thanks so much.
 
Upvote 0

Forum statistics

Threads
1,221,834
Messages
6,162,268
Members
451,758
Latest member
lmcquade91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top