Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2008, 04:51 PM
Authorized User
 
Join Date: Nov 2007
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default CODE FOR NUMBER AND ABOVE

Hello and Thanks
I want to search in a number field for all records with the
combo box value number and above.
Ex. If the value is 200 then all records with the value 200 and above.
Can anyone show me the code to do this?

here is the code I'm working with so far:(note, there are 14 arrays but I'm just going to show 1)

Dim strFilt(0 To 14) As String
Dim aryIdx As Integer
Dim FiltStr As String
Dim DTAboveNo As Long
Dim DTAboveVAl As Long

If IsNull(cboDTAbove.Value) = False Then
        DTAboveVAl = cboDTAbove.Value
        DTAboveNo = [DgnTemp] > DTAboveVAl
End If
If TogFilter.Value = -1 Then
If DTAboveNo <> "" Then strFilt(14) = "DTAboveNo"

  For aryIdx = LBound(strFilt) To UBound(strFilt)
            If strFilt(aryIdx) <> "" Then
                If FiltStr <> "" Then
                    FiltStr = FiltStr & " and " & strFilt(aryIdx)
                Else
                    FiltStr = strFilt(aryIdx)
                End If
            End If
        Next aryIdx
    End If

    If FiltStr = "" Then
        FiltStr = "[LineNo] <> ''"
    Else
        FiltStr = "(" & FiltStr & ")"
    End If
    Me.Filter = FiltStr
    Me.FilterOn = True

;=========================end



 
Old February 27th, 2008, 06:48 PM
Authorized User
 
Join Date: Nov 2007
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well I found a fix, here is the code:

    If IsNull(cboDTAbove.Value) = False Then
        DTAboveVal = "[DgnTemp] >= " & cboDTAbove.Value
        cboDTemp.Value = ""
    End If

When I filter it, it worked. Not saying its the best code, but it gave the output.
Thanks anyway. I love it when code works!







Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation For Phone Number and Mobile Number dhruthi.ram99 Javascript How-To 12 October 30th, 2011 07:24 AM
Validate two textbox one for area code and number debjanib ASP.NET 1.0 and 1.1 Professional 1 June 6th, 2006 01:00 PM
Number Validation ben805 Access VBA 0 December 5th, 2005 04:06 PM
number? crmpicco Classic ASP Basics 2 June 10th, 2005 05:14 AM
random number code rob209 SQL Server 2000 1 June 17th, 2004 04:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.