Using Null in an Event Procedure

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.
 
R

Rick Brandt

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, "")
 
G

Guest

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, "")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top