+ Reply to Thread
Results 1 to 3 of 3

Insert Blank date values into Access from text form control

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    Everett, WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Insert Blank date values into Access from text form control

    I have a form with textboxes displaying dates from a monthcontol. My access table has those coorisponding dates as Date/Time fields.
    The update query has a nested IF that needs to identify if the form textbox has a value, if not it needs to insert Null into database, else input the value from the form textbox.
    See query below
    Please Login or Register  to view this content.
    I keep getting a Data mismatch error and cannot figure it out. I have tried various iterations of code to fix. Above is only an example of several failed attempts.

    Thanks for any help

  2. #2
    Registered User
    Join Date
    06-29-2005
    Location
    Boston, MA
    Posts
    56

    Re: Insert Blank date values into Access from text form control

    Access query in VBA has a few tricks. First, the query string has to have double quotes at each end, BUT single quotes inside the query when the query needs to see 'text', so

    " SELECT * from tblname where tblName.field = 'Yes' "

    to concatenate a query and a text field and a query,

    " Select * from tblName where tblName.field = " & controlfield & ";"

    try these different syntax approaches

    sportsguy

  3. #3
    Registered User
    Join Date
    01-04-2013
    Location
    Everett, WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Insert Blank date values into Access from text form control

    Thanks SportsGuy,

    This is good information, but still cannot make it work to my specific example. I can get the value of the textboxes by using your example, but I think the problem is the use of null going into the database. If the value of the textbox is Null it doesnt work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1