INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Global variable not set

Global variable not set

(OP)
Hi,

I have a working program on a Windows XP Client.

Both programs run from C:\Comtec\Comtec_country.exe

When I run the program on the Windows 7 client, I get the following VB error (in bold below) - I've pasted the whole program code

Can anyone assist? Thanks

-------------

Option Compare Database

Private Sub Command13_Click()
Numberboxes = InputBox("How many boxes do you want to label")
Weight = InputBox("What's the Gross Weight of the Shipment")
address2 = FindReplace(address, Chr(13) & Chr(10), "#@#")
If addinfo = "" Then addinfo = "-"
commandStr = "C:\comtec\comtec_country.exe " & Chr(34) & Numberboxes & "||" & Weight & "||" & address2 & "||" & addinfo & "||" & Now() & Chr(34)
'MsgBox (commandStr)
Shell (commandStr)
Rem haha


End Sub

Private Sub First_Click()
On Error GoTo Err_First_Click


DoCmd.GoToRecord , , acFirst

Exit_First_Click:
Exit Sub

Err_First_Click:
MsgBox Err.Description
Resume Exit_First_Click

End Sub
Private Sub prev_Click()
On Error GoTo Err_prev_Click


DoCmd.GoToRecord , , acPrevious

Exit_prev_Click:
Exit Sub

Err_prev_Click:
MsgBox Err.Description
Resume Exit_prev_Click

End Sub
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click


DoCmd.GoToRecord , , acNext

Exit_Command9_Click:
Exit Sub

Err_Command9_Click:
MsgBox Err.Description
Resume Exit_Command9_Click

End Sub
Private Sub Last_Click()
On Error GoTo Err_Last_Click


DoCmd.GoToRecord , , acLast

Exit_Last_Click:
Exit Sub

Err_Last_Click:
MsgBox Err.Description
Resume Exit_Last_Click

End Sub
Private Sub new_Click()
On Error GoTo Err_new_Click


DoCmd.GoToRecord , , acNewRec

Exit_new_Click:
Exit Sub

Err_new_Click:
MsgBox Err.Description
Resume Exit_new_Click

End Sub
Function FindReplace(strOrig As Variant, strOld As String, strNew As String)
'Function to search and replace characters in a string
'-----------------------------------------------------------
' ARGUEMENT DESCRIPTION
' --------------------------------------------------------
' strOrig String in which to
' search/replace.
'
' strOld String you are searching for.
'
' strNew String to replace the searched
' for string.
' --------------------------------------------------------
' EXAMPLE
' --------------------------------------------------------
' MyString = "555.318.6755"
' MyNewString = FindReplace(MyString,".","-")
' (MyNewString is now "555-318-6755")
'-----------------------------------------------------------

Dim intAt As Integer, strAltered As String

'Check for arguements
If IsNull(strOld) Or IsNull(strNew) Then
FindReplace = "ERROR! CHECK ARGUEMENTS!"
Exit Function
End If

'Check for null string
If IsNull(strOrig) Then
FindReplace = Null
Exit Function
End If

'Do function
For intAt = 1 To Len(strOrig)
If Mid(strOrig, intAt, Len(strOld)) = strOld Then
strAltered = strAltered & strNew
intAt = intAt + (Len(strOld) - 1)
Else
strAltered = strAltered & Mid(strOrig, intAt, 1)
End If
Next intAt
FindReplace = strAltered

End Function

RE: Global variable not set

(OP)
Thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close