OpenArgs

R

Raul Sousa

I have the following code on open Event.

DoCmd.GoToRecord , , acNewRec
Name.Value = OpenArgs

If I open the form to insert data, and open arguments do
not exist, it opens on a new record and the field Name
has a null value.
If I open it though VB as a dialog box, and open
arguments have a value, it opens on a new record and the
field Name has a value.

As I need that:
If I open the form to insert data, and open arguments do
not exist, it does nothing
If I open it though VB as a dialog box, and open
arguments have a value, it opens on a new record and the
field Name has a value.

So I used the following code on open Event.

If Not (OpenArgs = Null) Then
DoCmd.GoToRecord , , acNewRec
Nome.Value = OpenArgs
End If

I thought this would solve my question, but it didn't
because:
If I open the form to insert data, and open arguments do
not exist, it does nothing
If I open it though VB as a dialog box, and open
arguments have a value, it opens on a new record and the
field Name has NO value.

I can't see why. Can anyone of you give me an idea?
I am using access 2003 Beta, and I am a new user, not
very skillful.
 
D

DR

Well, if the code example you gave here was cut & pasted
from your procedure, then the obvious problem is
that "Name" is misspelled as "Nome". Therefore "Name" is
never assigned a value.
 
K

Ken Snell

You cannot see if anything is equal to Null...nothing, including Null, is
equal to Null.

Also, the OpenArgs value is text. Therefore, if it has no value, it's an
empty string, not Null.

Thus, change the code in the form that is being opened to this:

If Me.OpenArgs = "" Then
DoCmd.GoToRecord , , acNewRec
Nome.Value = Me.OpenArgs
End If
 
R

Raul Sousa

Thank you.
That was the ansewr.
-----Original Message-----
You cannot see if anything is equal to Null...nothing, including Null, is
equal to Null.

Also, the OpenArgs value is text. Therefore, if it has no value, it's an
empty string, not Null.

Thus, change the code in the form that is being opened to this:

If Me.OpenArgs = "" Then
DoCmd.GoToRecord , , acNewRec
Nome.Value = Me.OpenArgs
End If

--
Ken Snell
<MS ACCESS MVP>




.
 

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

Similar Threads


Top