Run-time error '5'

  • Thread starter shanesullaway via AccessMonster.com
  • Start date
S

shanesullaway via AccessMonster.com

I have a function that I am trying to massage a little and keep getting the
error listed in my subject line. "Invalid procedure or argument." I am
listing part of the code below (I think if will be enough to get the problem
across but let me know if I need to show more of it) I am trying to use the
Tag property of controls on my form to communicate a couple pieces of
information to me separated by a ";" Any help will be appreciated. stTag is
where Access points to having a problem.

Code:


Dim ctl As Access.Control
Dim strErrCtlName As String
Dim strErrorMessage As String
Dim lngErrCtlTabIndex As Long
Dim blnNoValue As Boolean

lngErrCtlTabIndex = 99999999 'more than max #controls

For Each ctl In frm.Controls
With ctl
Select Case .ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
Dim stTag As String
stTag = Left(.Tag, InStr(.Tag, ";") - 1)

TIA,
Shane
 
J

John W. Vinson

I have a function that I am trying to massage a little and keep getting the
error listed in my subject line. "Invalid procedure or argument." I am
listing part of the code below (I think if will be enough to get the problem
across but let me know if I need to show more of it) I am trying to use the
Tag property of controls on my form to communicate a couple pieces of
information to me separated by a ";" Any help will be appreciated. stTag is
where Access points to having a problem.

Code:


Dim ctl As Access.Control
Dim strErrCtlName As String
Dim strErrorMessage As String
Dim lngErrCtlTabIndex As Long
Dim blnNoValue As Boolean

lngErrCtlTabIndex = 99999999 'more than max #controls

For Each ctl In frm.Controls
With ctl
Select Case .ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
Dim stTag As String
stTag = Left(.Tag, InStr(.Tag, ";") - 1)

TIA,
Shane

You'll get an error like this if Tag is null or does not contain a semicolon.
 
S

shanesullaway via AccessMonster.com

Thanks for your reply Mr. Vinson. Could I go one step further and ask you
for suggestions on how to trap for both of those cases?

Thanks,
Shane
I have a function that I am trying to massage a little and keep getting the
error listed in my subject line. "Invalid procedure or argument." I am
[quoted text clipped - 23 lines]
TIA,
Shane

You'll get an error like this if Tag is null or does not contain a semicolon.
 
J

John W. Vinson

Thanks for your reply Mr. Vinson. Could I go one step further and ask you
for suggestions on how to trap for both of those cases?

Just check first:
IIF(InStr(.tag & "", ";") > 0 Then
stTag = Left(.Tag, InStr(.Tag, ";") - 1)
End If
 
S

shanesullaway via AccessMonster.com

Thank you Mr. Vinson, I will give it a try. I really appreciate your help.

Shane
 

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