[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to compare DataSet value to a Date enter.

Posted on 2011-02-10
2
Medium Priority
?
385 Views
Last Modified: 2012-05-11
How do I compare Date enterd to a DataSet in the code below:
'Warn user if the Posted entered is a future date.
        If UtilityClass.UnmaskDate(Me.fPostedDate.Text) = Nothing Then
            'nothing to check, bail out
            Exit Sub
        End If
'Error Here
        Select Case (UtilityClass.UnmaskDate(Me.fPostedDate.Text) = Format(PaymentsDataSet.Tables(0).Rows(I).Item("PostedDate"), "MM/dd/yy"))
            Case False
                Exit Sub
            Case True
                Select Case LastNewFinRecord
                    Case 0
                        ' there is not a new finance record id yet. leave it alone
                    Case CInt(Me.fFinRecID.Text)
                        If UtilityClass.UnmaskDate(Me.fPostedDate.Text) = Nothing Then
                            'nothing to check, bail out
                            Exit Sub
                        Else
                            ' Is the Posted Date greater than Today.
                            If (DateTime.Parse(UtilityClass.UnmaskDate(Me.fPostedDate.Text))) > DateTime.Parse(UtilityClass.UnmaskDate(Today)) Then
                                Select Case MessageBox.Show("This Date is in the FUTURE" & vbCrLf & "Is that correct.", "Incorrect Posted Date", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
                                    Case vbYes
                                        Me.fPostMarkDate.Focus()
                                    Case vbNo
                                        Me.fPostedDate.Focus()
                                End Select
                            End If
                        End If
                    Case Else
                End Select
        End Select

Open in new window

I get Arguement expression is not valid value.
0
Comment
Question by:pelon_80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
skipper68 earned 2000 total points
ID: 34867454
It appears that there may be some values that are "null" (empty). What would you like to do with them?  To confirm, you can display a message box before the line it's failing on to determine this.

If there are nulls in the data, then you should check to see if it is = DBNull.Value before you try to use it in any function or before casting them ( CInt () ).

if Me.xx.Text <> DBNull.Value Then
     'Do Something
else
     'Do Something Else
End If

0
 

Author Closing Comment

by:pelon_80
ID: 34871682
Great! Thanks
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question