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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

empty value for an date variable?????

Status
Not open for further replies.

autoIT

IS-IT--Management
May 10, 2006
68
US
I have a table with a column set as date
I have a textbox that I want a date entered into
I want that value in that textbox passed into the table

Issue is that sometime a value for a date is empty. I have tried many combinations for dimming a variable and setting the column in the table=date. If i dim the variable as date i can pass it "" if there is no input, but if i dim the variable as string i can pass "" but then I can't pass the variable to a table with a column set to date. How do empty variables on dates work and what is my best option here?


One other question is can anyone suggest a website that explains input masks well. I am a little fuzy on creating them.


Adam

 
If you allow nulls, you could possibly pass that to your table?

A wise man once said
"The only thing normal about database guys is their tables".
 
so like this

if date1.text = Is IsNull then
date1 = ""
End If

or

if date1.text = "" then
date1 = Is IsNull
End If

or am I way off. I just can't get the right combo
 
You would use the second, but set date1 = NULL.

However I don't think your strategy here is going to do what you are trying to do. What I think you really want to do is update the table by using a SQL command. To do that you could try something like this:

Code:
if date1.text = "" then
     DoCmd.RunSQL "update TABLENAME set date1 = null"
End If
I'd think you would want a WHERE clause in there somewhere though (otherwise you will update date1 for every single row).

Are you using an unbound text box to enter the date?

A wise man once said
"The only thing normal about database guys is their tables".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top