1 Replies - 279 Views - Last Post: 26 September 2018 - 02:01 PM Rate Topic: -----

#1 kirito0508   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-September 18

i want to search again based on the data searched

Posted 25 September 2018 - 03:16 AM

can you help me with the code of searching based on the searched data on database.

Adodc1.RecordSource = "select * from Permit where PD_Date between #" & date1 & "# and #" & date2 & "#"
        Adodc1.Refresh
        DataGrid1.Refresh
        
        If Adodc1.Recordset.EOF Then
        
            MsgBox "Record Not Found!", vbInformation + vbOKOnly, "Warning!"
        
        Else
            Adodc1.RecordSource = "select * from Permit where Type = '" & Option1.Caption & "'"
            
            Adodc1.Refresh
            DataGrid1.Refresh
            Label22.Caption = Adodc1.Recordset.RecordCount
        End If
:code:

that one is searching between 2 dates. but i want to search again based on that search. i have 2 fields (fields(0)= type(PSN or PTW)) (fields(1)=date)
if i search between 2 dates in will search and if select type on form it will search all the type (PSN or PTW) on the date i searched bwetween 2 dates.

This post has been edited by modi123_1: 26 September 2018 - 02:10 PM
Reason for edit:: In the future, please use the [code] tag button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: i want to search again based on the data searched

#2 TechnoBear   User is offline

  • Lady A
  • member icon

Reputation: 445
  • View blog
  • Posts: 1,381
  • Joined: 02-November 11

Re: i want to search again based on the data searched

Posted 26 September 2018 - 02:01 PM

Code tags so I can read it, but what exactly are you trying to achieve and what is your code currently not doing that it needs to or what is it doing that it shouldn't be?

Adodc1.RecordSource = "select * from Permit where PD_Date between #" & date1 & "# and #" & date2 & "#"
Adodc1.Refresh
DataGrid1.Refresh

If Adodc1.Recordset.EOF Then

MsgBox "Record Not Found!", vbInformation + vbOKOnly, "Warning!"

Else
Adodc1.RecordSource = "select * from Permit where Type = '" & Option1.Caption & "'"

Adodc1.Refresh
DataGrid1.Refresh
Label22.Caption = Adodc1.Recordset.RecordCount
End If

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1