By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,051 Members | 1,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,051 IT Pros & Developers. It's quick & easy.

Assigning a Variable OpenArgs

P: n/a
nic
Hi am having difficulty understanding why the following is not
working.

Dim TempID As Integer
Set TempID = Me.OpenArgs

Knowing that OpenArgs is a string I then changed the declaration of
TempID to be String, but this does not work either.

I have also tried

Set TempID = Val(OpenArgs) 'where TempID is an integer.

Can anyone suggest possible solutions. I need the value of OpenArgs
to be copied this TempID variale as I need it for a particular
programming purpose.

Thanks
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Delete the word 'Set' (and make sure TempId is a string)

regards

Peter Russell
nic previously wrote:
Hi am having difficulty understanding why the following is not
working.

Dim TempID As Integer
Set TempID = Me.OpenArgs

Knowing that OpenArgs is a string I then changed the declaration of
TempID to be String, but this does not work either.

I have also tried

Set TempID = Val(OpenArgs) 'where TempID is an integer.

Can anyone suggest possible solutions. I need the value of OpenArgs
to be copied this TempID variale as I need it for a particular
programming purpose.

Thanks


Nov 12 '05 #2

P: n/a
ni*******@yahoo.co.uk (nic) wrote in news:aa26ac1d.0402020346.6bf2ae33
@posting.google.com:
Hi am having difficulty understanding why the following is not
working.

Dim TempID As Integer
Set TempID = Me.OpenArgs

Knowing that OpenArgs is a string I then changed the declaration of
TempID to be String, but this does not work either.

I have also tried

Set TempID = Val(OpenArgs) 'where TempID is an integer.

Can anyone suggest possible solutions. I need the value of OpenArgs
to be copied this TempID variale as I need it for a particular
programming purpose.


TempID = Me.OpenArgs

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #3

P: n/a
"nic" <ni*******@yahoo.co.uk> wrote in message
news:aa**************************@posting.google.c om...
Hi am having difficulty understanding why the following is not
working.

Dim TempID As Integer
Set TempID = Me.OpenArgs

Knowing that OpenArgs is a string I then changed the declaration of
TempID to be String, but this does not work either.

I have also tried

Set TempID = Val(OpenArgs) 'where TempID is an integer.

Can anyone suggest possible solutions. I need the value of OpenArgs
to be copied this TempID variale as I need it for a particular
programming purpose.

Thanks


You could use code similar to that shown below, making sure you have some
kind of error-handling to take appropriate action if the OpenArgs cannot be
converted into the required type.

Dim lngMyID As Long

If Not IsNull(Me.OpenArgs) Then
lngMyID = CLng(Me.OpenArgs)
End If
Fletcher
Nov 12 '05 #4

P: n/a
Dim TempID As Integer
TempID = cint(Me.OpenArgs)

you don't need the word SET

ni*******@yahoo.co.uk (nic) wrote in message news:<aa**************************@posting.google. com>...
Hi am having difficulty understanding why the following is not
working.

Dim TempID As Integer
Set TempID = Me.OpenArgs

Knowing that OpenArgs is a string I then changed the declaration of
TempID to be String, but this does not work either.

I have also tried

Set TempID = Val(OpenArgs) 'where TempID is an integer.

Can anyone suggest possible solutions. I need the value of OpenArgs
to be copied this TempID variale as I need it for a particular
programming purpose.

Thanks

Nov 12 '05 #5

P: n/a
Thanks Peter and Others

Wasn't thinking straight. Because I needed TempID to be an integer I
did it the following way.

TempID = Var(OpenArgs)

Having the following problem....Say I created a new record in a form and
wanted all this data to be written to the Table when I clicked another
button which loaded another form. Cannot get the form to write data to
the table first, so in the second form because a referenced id does not
yet exist it cannot write data to the second table.

Thanks for any comments

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.