Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i am trying to select data on date parameters but he through empty exception
plz. suggest me to select date from my access database

What I have tried:

Private Sub MOD_SUB_DATa1()
      grp_invwise.Visible = False
      grp_datewise.Visible = False
      grp_partywise.Visible = False
      If MOD_SUB = 1 Then
          access.addparam("@INVNO", txt_mod_inv_start.Text)
            access.Execquery(" select INVOICE_NO,INVOICE_DATE,PARTY_NAME,INVOICE_AMOUNT_tax,IGST_TAX,CGST_TAX,SGST_TAX,sl_trancode,ID from invoice WHERE INVOICE_NO=@INVNO ")
          If noerrors(True) = False Then MsgBox(access.Exception) : Exit Sub
          dgv_sl.DataSource = access.dbdt

      End If
      If MOD_SUB = 2 Then
          access.addparam1("@INVNO", DateTimePicker1.Value)
          access.Execquery("select INVOICE_NO,INVOICE_DATE,PARTY_NAME,INVOICE_AMOUNT_tax,IGST_TAX,CGST_TAX,SGST_TAX,sl_trancode,ID from invoice WHERE INVOICE_DATE=@INVNO ")
          If noerrors(True) = False Then MsgBox(access.Exception) : Exit Sub
          dgv_sl.DataSource = access.dbdt
      End If
  End Sub
Posted
Updated 23-Jan-18 19:54pm
v3
Comments
Richard MacCutchan 2-Sep-17 4:06am    
Which variable causes the exception?
yogesh vaidya 2-Sep-17 4:25am    
in second close mod_sub=2 then ...
"@invno" is a parameter variable and value is datetimepicker1
i am using a method private access dbcntorl to connect database ,
in first option mod_sub=1 i got the stipulated data in datagride .
but date() format can't support here

1 solution

Date values are not text, so:

access.addparam("@INVNO", txt_mod_inv_start.Value)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900