Using Null in an Event Procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Access 2002 under WinXp.
References checked:
Visual Basic for Applications; Microsoft Library Access 10 Object Library;
OlE Automation; Microsoft ActiveX Data Objects 2.1 Library

code is as follows:

Private Sub QRZ_Click()
On Error GoTo Err_QRZ_Click

Dim stAppName As String
Dim csign As String
csign = Me!strHamCall

stAppName = "C:\Program Files\Internet Explorer\iexplore.exe
http://www.qrz.com/callsign/" & csign
Call Shell(stAppName, 1)

Exit_QRZ_Click:
Exit Sub

Err_QRZ_Click:
MsgBox Err.Description
Resume Exit_QRZ_Click

End Sub

My problem is that I would like to be able to perform the code without '&
csign' if [Me!strHamCall] is null. This is a text string.

I've tried a many suggestions on the message boards and can't quite get the
code correct. I always get the error message; "Invalid Use of Null".

Thanks in advance.
 
Jim said:
I am using Access 2002 under WinXp.
References checked:
Visual Basic for Applications; Microsoft Library Access 10 Object
Library; OlE Automation; Microsoft ActiveX Data Objects 2.1 Library

code is as follows:

Private Sub QRZ_Click()
On Error GoTo Err_QRZ_Click

Dim stAppName As String
Dim csign As String
csign = Me!strHamCall

stAppName = "C:\Program Files\Internet Explorer\iexplore.exe
http://www.qrz.com/callsign/" & csign
Call Shell(stAppName, 1)

Exit_QRZ_Click:
Exit Sub

Err_QRZ_Click:
MsgBox Err.Description
Resume Exit_QRZ_Click

End Sub

My problem is that I would like to be able to perform the code
without '& csign' if [Me!strHamCall] is null. This is a text string.

I've tried a many suggestions on the message boards and can't quite
get the code correct. I always get the error message; "Invalid Use of
Null".

Thanks in advance.

Dim stAppName As String
Dim csign As String
csign = Nz(Me!strHamCall, "")
 
Thanks Rick. That was a lot easier than I thought it would be.
--
Jim Ory


Rick Brandt said:
Jim said:
I am using Access 2002 under WinXp.
References checked:
Visual Basic for Applications; Microsoft Library Access 10 Object
Library; OlE Automation; Microsoft ActiveX Data Objects 2.1 Library

code is as follows:

Private Sub QRZ_Click()
On Error GoTo Err_QRZ_Click

Dim stAppName As String
Dim csign As String
csign = Me!strHamCall

stAppName = "C:\Program Files\Internet Explorer\iexplore.exe
http://www.qrz.com/callsign/" & csign
Call Shell(stAppName, 1)

Exit_QRZ_Click:
Exit Sub

Err_QRZ_Click:
MsgBox Err.Description
Resume Exit_QRZ_Click

End Sub

My problem is that I would like to be able to perform the code
without '& csign' if [Me!strHamCall] is null. This is a text string.

I've tried a many suggestions on the message boards and can't quite
get the code correct. I always get the error message; "Invalid Use of
Null".

Thanks in advance.

Dim stAppName As String
Dim csign As String
csign = Nz(Me!strHamCall, "")
 
Back
Top