yes/no question for if job in table exists

johncassell

Well-known member
Joined
Jun 10, 2007
Messages
120
Location
Redcar, England
Programming Experience
Beginner
Hi There,

I have a 'Jobs' table with column 'JobID'.

I have created a query to return the number of times a particular job number appears in the column.

This works as expected when there IS a job.

If the job isn't there then I run into trouble.

I would like a message box in my application to tell me if the job is there or not. but I get the error shown below.

Can anyone help me with this please?

Thanks

John
 

Attachments

  • nullableerror.JPG
    nullableerror.JPG
    57.2 KB · Views: 35
Hi,

figured it now, for those interested..
VB.NET:
Expand Collapse Copy
If Me.JobsTableAdapter.CountJob(JobIDTextBox.Text).HasValue = True Then
            MsgBox("Yes is there")
        Else
            MsgBox("No isn't there")
        End If

Thanks

John
 
GetValueOrDefault(default) will either return you the value it is, or the value gave if it isnt :)
 
Back
Top