Does Me.[Entity Name] contain anything?
My advice would be to put a special character as a delimiter, a character
that will never appear in the data that's being passed (such as ~), so that
you'll have "Testing Name Entity~HTML Document"
Then, use:
Dim x As Integer
x = InStr(Me.OpenArgs, "~")
If x > 0 Then
If Me.NewRecord Then
Me.[Entity Name] = Left(Me.OpenArgs, x - 1)
Me.[Entity Type] = Mid(Me.OpenArgs, x + 1)
End If
End If
Alternatively, assuming you're using Access 2000 or newer, you could use
Dim x As Integer
Dim varArgs As Variant
x = InStr(Me.OpenArgs, "~")
If x > 0 Then
If Me.NewRecord Then
varArgs = Split(Me.OpenArgs, "~")
Me.[Entity Name] = varArgs(0)
Me.[Entity Type] = varArgs(1)
End If
End If
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Steve said:
The OpenArgs is passing 2 strings attached, the testing name I've given
it is "Testing Name EntityHTML Document" (without out the quotes). I'm
hoping the InStr will find the 1st field name "Testing Name Entity" and
allow me to split the string.
If you haven't populated it yet, then Me.[Entity Name] is going to be null.
What exactly are you passing as the OpenArgs parameter of the OpenForm
method? What are you hoping the InStr function will find?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Dim x As Integer
x = InStr(Me.OpenArgs, Me.[Entity Name])
If Me.NewRecord Then
Me.[Entity Name] = Left(Me.OpenArgs, x)
Me.[Entity Type] = Right(Me.OpenArgs, Len(Me.OpenArgs - x))
End If
This function will lock the strings inputed by another form. Well I
need 2 fields locked with the data, and the only way to do that is by
splitting it. This keeps giving me the error "Invalid use of Null".
Am I doing something wrong?