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!

VBA error 1

Status
Not open for further replies.

ceil32

MIS
Apr 8, 2008
263
0
0
IE
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
 
What happens if you copy/paste this value in a command window and execute it ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm prompted through UAC to run the Comtec_country.exe program.

A Command briefly flashes up, disappears and nothing happens.
 
So, now you know where is the problem ...
 
Thanks for all the assistance folks - guess it's an OS compatability issue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top