Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null field shuts down database 1

Status
Not open for further replies.

edsearl

Programmer
May 8, 2002
24
0
0
US
Microsoft shuts down the application when the voltage field is empty.
I tried "if [voltage] is null goto exit_Drawing_DblClick",but it didn't work.

Private Sub Drawing_Click()
Dim strinput As String
Dim Name As String
Dim symbol As String

On Error GoTo err_drawing
If [Voltage] = 4.34 Then
strinput = "F:\NR-Scanned-Drawings\FEEDERS\" & Me("symbol") & " " & Me("name") & ".tif"
End If
If [Voltage] = 4.8 Then
strinput = "F:\NR-Scanned-Drawings\FEEDERS\" & Me("symbol") & " " & Me("name") & ".tif"
End If
If [Voltage] = 13.2 Then
strinput = "F:\NR-Scanned-Drawings\FEEDERS\" & Me("symbol") & " " & Me("name") & ".tif"
End If
If [Voltage] = 36.5 Then
strinput = "F:\NR-Scanned-Drawings\Subtransmission\" & Me("symbol") & " " & Me("name") & ".tif"
End If
If [Voltage] = 11.5 Then
strinput = "F:\NR-Scanned-Drawings\Subtransmission\11KV GROUP TRACINGS\" & Me("symbol") & " " & Me("name") & ".tif"
End If
Application.FollowHyperlink strinput, , True
exit_Drawing_DblClick:
Exit Sub

err_drawing:
MsgBox Err.Description
If [Voltage] = 4.34 Then
strinput = "F:\NR-Scanned-Drawings\FEEDERS"
End If
If [Voltage] = 4.8 Then
strinput = "F:\NR-Scanned-Drawings\FEEDERS"
End If
If [Voltage] = 13.2 Then
strinput = "F:\NR-Scanned-Drawings\FEEDERS"
End If
If [Voltage] = 36.5 Then
strinput = "F:\NR-Scanned-Drawings\Subtransmission"
End If
If [Voltage] = 11.5 Then
strinput = "F:\NR-Scanned-Drawings\Subtransmission\11KV GROUP TRACINGS"
End If

Application.FollowHyperlink strinput, , True
Exit Sub

End Sub
 
You may find Select Case more useful, otherwise you could try:

[tt]If IsNull(Voltage)[/tt]
 
Thank You Remou
The isnull works fine.
I will look up the select case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top