Results 1 to 3 of 3
  1. #1
    Nikh is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19

    How to Export Data From table to Excel where Date = Blank

    Hi..,

    I am unable to Export Data Into Excel from table using query where "Export_Date"=Blank. in Table



    Code:
    If Me.Option5 = -1 Then
                Set db = CurrentDb()
                Set Q = db.QueryDefs("CBDataEntryDump_Branchwise")
                Q.SQL = "Select * From CBDataEntryDump Where ([Branch_Name]= '" & TempVars!tempbranchname & "') AND ([Export]= '-1') AND Export_Date = NULL ;"
                Q.Close
                
                cbfilename = Environ("USERPROFILE") & "\Desktop\" & TempVars!tempbranchname & "_EquifaxReport_" & Format(Now(), "DDMMYYYY_HHMM") & ".xlsb"
                
                DoCmd.OutputTo acOutputQuery, "CBDataEntryDump_Branchwise", acFormatXLSB, cbfilename, False
                
                MsgBox " Data Exported to Desktop Sucessfully", vbInformation, "Data Export Successfully"
          
        End If

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Don't use SQL, use a query, then you wouldn't have the error.
    you don't use = for null, it's :
    field Is NULL.

    booluean fields are numeric not string,
    field = -1

  3. #3
    Nikh is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19
    Quote Originally Posted by ranman256 View Post
    Don't use SQL, use a query, then you wouldn't have the error.
    you don't use = for null, it's :
    field Is NULL.

    booluean fields are numeric not string,
    field = -1

    can you please share modified code as I am new and not understand how to code this..

    Thanks in Advance.

    Nikh

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-07-2016, 04:36 AM
  2. Replies: 2
    Last Post: 08-16-2015, 07:04 PM
  3. Replies: 6
    Last Post: 06-04-2014, 12:00 AM
  4. Export Data to Excel Pivot Table Loss of Formatting
    By Damian in forum Import/Export Data
    Replies: 1
    Last Post: 05-17-2013, 07:56 PM
  5. trying to export table data tpo Excel
    By itm in forum Access
    Replies: 2
    Last Post: 01-30-2012, 10:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums