Opening a new linked form gives #Name error (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 17:54
Joined
Sep 21, 2011
Messages
14,259
Is that what you had? Upon reviewing your posts I can't find where you were using that otherwise I wouldn't have suggested it at such a late stage. Thanks dbg - it's there in web docs as well. I missed it.

So the explanation is that OpenArgs of text type have to be delimited same as if you were trying to pass a literal string to a control, such as "apple"?

Not me Micron, Lanser was the o/p.
I was just trying to get to the bottom of the problem.

Lanser was just assigning OpenArgs on it's own.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:54
Joined
Oct 29, 2018
Messages
21,467
Just realised that is you wanted to add more than one record at a time, you would need defaultvalue?
And the other thing is if the users change their minds and simply closed the new form, you could get left with an empty record if you didn't use the default value property.
 
Last edited:

Micron

AWF VIP
Local time
Today, 12:54
Joined
Oct 20, 2018
Messages
3,478
@Gasman; I realize you weren't OP but I read

However I'd still go with my method, just for a little less typing, but good to know about.
Me.DocRef.DefaultValue = """ & Me.OpenArgs & """

as if it was your method. Not sure what your method is - perhaps just assigning to the vale property then. dbg makes a good point about possible incomplete record.
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 17:54
Joined
Sep 21, 2011
Messages
14,259
My method was just to set the control value to the OpenArgs, not it's DefaultValue, however I have since realised that in some circumstances that would not be the best way.

That is how I have done it in the past, with Esc to cancel a new record.
 

missinglinq

AWF VIP
Local time
Today, 12:54
Joined
Jun 20, 2003
Messages
6,423
Knew something didn't look quit right...actually that has to be

Me.DocRef.DefaultValue = """" & Me.OpenArgs & """"

or else the Default Value you'll end up with will be

& Me.OpenArgs &

not the passed value.

Linq ;0)>
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:54
Joined
Sep 21, 2011
Messages
14,259
I do not know what to say, I copied the code I posted straight from the form.?

DB is attached. Form NewVerForm
 

Attachments

  • Document Control_old.zip
    640.7 KB · Views: 32

Micron

AWF VIP
Local time
Today, 12:54
Joined
Oct 20, 2018
Messages
3,478
Knew something didn't look quit right...actually that has to be
Me.DocRef.DefaultValue = """" & Me.OpenArgs & """"
Linq ;0)>
Hmmm - don't know why. What I posted worked for me
"'" & Me.OpenArgs & "'"
 

missinglinq

AWF VIP
Local time
Today, 12:54
Joined
Jun 20, 2003
Messages
6,423
Surprisinghly...what you just posted

" ' " & Me.OpenArgs & " ' "
does, indeed, work! As well as my code

"""" & Me.OpenArgs & """"

but the original code, which was co-opted from Access Help, was

" " " & Me.OpenArgs & " " "

with three Double Quotes on each end...which doesn't work, as I noted...instead of Double Quote - Single Quote - Double Quote, which does.

Is anyone surprised that Access Help got it wrong?

Linq ;0)>
 

missinglinq

AWF VIP
Local time
Today, 12:54
Joined
Jun 20, 2003
Messages
6,423
I do not know what to say, I copied the code I posted straight from the form.?

DB is attached. Form NewVerForm

Running the code in your posted file...using

""" & Me.OpenArgs & """

with 3 Double Quotes, on either end

produces

& Me.OpenArgs &

in the Control, as I said...not the appropriate DocRef.

Linq ;0)>
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:54
Joined
Sep 21, 2011
Messages
14,259
My apologies,
I had created a new form in case the form was corrupted and was still using that, with my original Load method. :banghead::banghead:

Running the code in your posted file...using

""" & Me.OpenArgs & """

with 3 Double Quotes, on either end

produces

& Me.OpenArgs &

in the Control, as I said...not the appropriate DocRef.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom