setting focus to 3rd subform

G

Guest

I get error 2455 expression has invalid reference to property form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting to add a
record at Invoicefrm using ".Form.AllowAdditions" and some other stuff, but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
P

Pieter Wijnen

Make sure the name of the Control holding the subform has the same name as
the Form.

HTH

Pieter
 
G

Guest

Thanks for responding. Not sure what you mean.

Pieter Wijnen said:
Make sure the name of the Control holding the subform has the same name as
the Form.

HTH

Pieter

redFred said:
I get error 2455 expression has invalid reference to property form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting to add
a
record at Invoicefrm using ".Form.AllowAdditions" and some other stuff,
but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
D

Douglas J. Steele

The first approach will never work because subforms aren't actually part ot
the Forms collection.

Try:

Me![Reservationfrm]![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

As Pieter pointed out, make sure that the name of the control containing the
subform is what you're using: depending how to add the subform to the parent
form, the name of the subform control may be different than the name of the
form being used as a subform.

You may find http://www.mvps.org/access/forms/frm0031.htm at "The Access
Web" a useful resource.
 
P

Pieter Wijnen

Any subform on a form is basically just a control that contains a reference
to a form
hence the Referencing:

Forms!MyForm!ControlHoldingAForm.Form

The ControlHoldingAForm can have a different name than the form contained in
the control
Best is to look through all the controls on the containing form to verify
the control names

I Hope this clarifies matters

Pieter


redFred said:
Thanks for responding. Not sure what you mean.

Pieter Wijnen said:
Make sure the name of the Control holding the subform has the same name
as
the Form.

HTH

Pieter

redFred said:
I get error 2455 expression has invalid reference to property
form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting to
add
a
record at Invoicefrm using ".Form.AllowAdditions" and some other stuff,
but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
G

Guest

Thanks to you both. Still I get the same message even after cut and paste
Doug's code.

The subform names are not the actual form names. My form "sfrm2 Invoice" is
what is contained on the subform I have named "Invoicefrm", so I think that's
ok -- right?

I do use tabs but I am under the impression that really doesn't matter as
controls on tabs are functionally the same as if the tabs were not there.
(Except the organization aspect).

I am really at wit's end but I'm sure solution is right here in front of me.


Douglas J. Steele said:
The first approach will never work because subforms aren't actually part ot
the Forms collection.

Try:

Me![Reservationfrm]![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

As Pieter pointed out, make sure that the name of the control containing the
subform is what you're using: depending how to add the subform to the parent
form, the name of the subform control may be different than the name of the
form being used as a subform.

You may find http://www.mvps.org/access/forms/frm0031.htm at "The Access
Web" a useful resource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


redFred said:
I get error 2455 expression has invalid reference to property form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting to add
a
record at Invoicefrm using ".Form.AllowAdditions" and some other stuff,
but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
P

Pieter Wijnen

I might have missed something (and you're right about "Invoicefrm"/"sfrm2
Invoice")

Me![Reservationfrm].Form![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

HTH
Pieter

redFred said:
Thanks to you both. Still I get the same message even after cut and paste
Doug's code.

The subform names are not the actual form names. My form "sfrm2 Invoice"
is
what is contained on the subform I have named "Invoicefrm", so I think
that's
ok -- right?

I do use tabs but I am under the impression that really doesn't matter as
controls on tabs are functionally the same as if the tabs were not there.
(Except the organization aspect).

I am really at wit's end but I'm sure solution is right here in front of
me.


Douglas J. Steele said:
The first approach will never work because subforms aren't actually part
ot
the Forms collection.

Try:

Me![Reservationfrm]![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

As Pieter pointed out, make sure that the name of the control containing
the
subform is what you're using: depending how to add the subform to the
parent
form, the name of the subform control may be different than the name of
the
form being used as a subform.

You may find http://www.mvps.org/access/forms/frm0031.htm at "The Access
Web" a useful resource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


redFred said:
I get error 2455 expression has invalid reference to property
form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting to
add
a
record at Invoicefrm using ".Form.AllowAdditions" and some other stuff,
but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
D

Douglas J. Steele

Yeah, I forgot that Reservationfrm is a subform as well, so the .Form is
required there as well.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Pieter Wijnen"
I might have missed something (and you're right about "Invoicefrm"/"sfrm2
Invoice")

Me![Reservationfrm].Form![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

HTH
Pieter

redFred said:
Thanks to you both. Still I get the same message even after cut and
paste
Doug's code.

The subform names are not the actual form names. My form "sfrm2 Invoice"
is
what is contained on the subform I have named "Invoicefrm", so I think
that's
ok -- right?

I do use tabs but I am under the impression that really doesn't matter as
controls on tabs are functionally the same as if the tabs were not there.
(Except the organization aspect).

I am really at wit's end but I'm sure solution is right here in front of
me.


Douglas J. Steele said:
The first approach will never work because subforms aren't actually part
ot
the Forms collection.

Try:

Me![Reservationfrm]![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

As Pieter pointed out, make sure that the name of the control containing
the
subform is what you're using: depending how to add the subform to the
parent
form, the name of the subform control may be different than the name of
the
form being used as a subform.

You may find http://www.mvps.org/access/forms/frm0031.htm at "The Access
Web" a useful resource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I get error 2455 expression has invalid reference to property
form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting to
add
a
record at Invoicefrm using ".Form.AllowAdditions" and some other
stuff,
but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
G

Guest

Thanks again....same error message with this code:


Me![Reservationfrm].Form![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus


Douglas J. Steele said:
Yeah, I forgot that Reservationfrm is a subform as well, so the .Form is
required there as well.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Pieter Wijnen"
I might have missed something (and you're right about "Invoicefrm"/"sfrm2
Invoice")

Me![Reservationfrm].Form![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

HTH
Pieter

redFred said:
Thanks to you both. Still I get the same message even after cut and
paste
Doug's code.

The subform names are not the actual form names. My form "sfrm2 Invoice"
is
what is contained on the subform I have named "Invoicefrm", so I think
that's
ok -- right?

I do use tabs but I am under the impression that really doesn't matter as
controls on tabs are functionally the same as if the tabs were not there.
(Except the organization aspect).

I am really at wit's end but I'm sure solution is right here in front of
me.


:

The first approach will never work because subforms aren't actually part
ot
the Forms collection.

Try:

Me![Reservationfrm]![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

As Pieter pointed out, make sure that the name of the control containing
the
subform is what you're using: depending how to add the subform to the
parent
form, the name of the subform control may be different than the name of
the
form being used as a subform.

You may find http://www.mvps.org/access/forms/frm0031.htm at "The Access
Web" a useful resource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I get error 2455 expression has invalid reference to property
form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting to
add
a
record at Invoicefrm using ".Form.AllowAdditions" and some other
stuff,
but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
P

Pieter Wijnen

Try them one by one & use dot notation all the way, to find the bug

Me.[Reservationfrm].Form.SetFocus
Me.[Reservationfrm].Form.Jobfrm.SetFocus
etc

HTFinallyH

Pieter

redFred said:
Thanks again....same error message with this code:


Me![Reservationfrm].Form![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus


Douglas J. Steele said:
Yeah, I forgot that Reservationfrm is a subform as well, so the .Form is
required there as well.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Pieter Wijnen"
I might have missed something (and you're right about
"Invoicefrm"/"sfrm2
Invoice")

Me![Reservationfrm].Form![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

HTH
Pieter

Thanks to you both. Still I get the same message even after cut and
paste
Doug's code.

The subform names are not the actual form names. My form "sfrm2
Invoice"
is
what is contained on the subform I have named "Invoicefrm", so I think
that's
ok -- right?

I do use tabs but I am under the impression that really doesn't matter
as
controls on tabs are functionally the same as if the tabs were not
there.
(Except the organization aspect).

I am really at wit's end but I'm sure solution is right here in front
of
me.


:

The first approach will never work because subforms aren't actually
part
ot
the Forms collection.

Try:

Me![Reservationfrm]![Jobfrm].Form![Invoicefrm].Form!txtHoldFocus.SetFocus

As Pieter pointed out, make sure that the name of the control
containing
the
subform is what you're using: depending how to add the subform to the
parent
form, the name of the subform control may be different than the name
of
the
form being used as a subform.

You may find http://www.mvps.org/access/forms/frm0031.htm at "The
Access
Web" a useful resource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I get error 2455 expression has invalid reference to property
form/reprort.

I've tried:
Forms![frm1 Client]. _
Form![Reservationfrm]. _
Form![Jobfrm]. _
Form![Invoicefrm]. _
Form!txtHoldFocus.SetFocus

Also:

Me![Reservationfrm]![Jobfrm]![Invoicefrm].Form!txtHoldFocus.SetFocus

The code is attached to a button on the main form. I am attempting
to
add
a
record at Invoicefrm using ".Form.AllowAdditions" and some other
stuff,
but I
cannot get the focus to Invoicefrm or a control on the form.

Can anyone see what I am doing wrong?
 
G

Guest

Thanks Pieter. That fails that I cannot go to the specified record. That
makes sense, since none yet exists. Recall that my ultimate goal is to add a
record to Invoicefrm.

Is there a way to add the record independent of setting focus? If so, then
I can just edit my new record (containing only key/required fields, of
course.)?

Thanks.
 
P

Pieter Wijnen

As long as the Control is Enabled (and indeed the subform too) & there's a
new record to goto it should be possible to set focus.
maybe if you provide the actual error number (& description) we can still
figure this out!

To Add a record this should do..

Dim Db As DAO.Database
Dim QDef As DAO.QueryDef

Set Db = Access.CurrentDb
Set Qdef = Db.CreateQueryDef(VBA.vbNullString,VBA.vbNullString)
Qdef.SQL = "PARAMETERS pMyLongField Long, pMyTextField Text, pMyDateField
Date;" & VBA.vbCrLf & _
"INSERT INTO MyTable (MyLongField, MyTextField,
MyDateField)" & VBA.vbCrlf & _
"VALUES(pMyLongField, pMyTextField, pMyDateField)"

Qdef.Parameters("pMyLongField").Value = 123456
Qdef.Parameters("pMyTextField").Value = "Hello world"
Qdef.Parameters("pMyDateField").Value = "#2007-12-23#"
' Or you can refer to controls w/o any type casting
Qdef.Parameters("pMyDateField").Value = Me.DateField.Value
'Or
Qdef.Parameters("pMyDateField").Value = VBA.Date()

' Finally
Qdef.Execute DAO.dbSeeChanges 'dbSeeChanges only needed for ODBC, but a
good habit
Qdef.Close : Set Qdef = Nothing
Set Db = Nothing

HTH

Pieter
 
G

Guest

Hmmmm....maybe you gave me a hint.

Jobfrm and its subform Invoicefrm are enabled and unlocked. However --
maybe this? -- data entry is NO for Jobfrm and Invoicefrm.

This fails with 2105 "You can't go to specified record."
Me![Reservationfrm].SetFocus
Me![Reservationfrm].Form.Jobfrm.SetFocus
Me![Reservationfrm].Form.Jobfrm.Form.Invoicefrm.SetFocus

Hoping this sheds light, while I thank you for the help.
 
G

Guest

Very good! But, I don't know how to ensure that I code properly to ensure
the new record is allowed. Help?

Pieter Wijnen said:
think we solved it there

Pieter

redFred said:
Hmmmm....maybe you gave me a hint.

Jobfrm and its subform Invoicefrm are enabled and unlocked. However --
maybe this? -- data entry is NO for Jobfrm and Invoicefrm.

This fails with 2105 "You can't go to specified record."
Me![Reservationfrm].SetFocus
Me![Reservationfrm].Form.Jobfrm.SetFocus
Me![Reservationfrm].Form.Jobfrm.Form.Invoicefrm.SetFocus

Hoping this sheds light, while I thank you for the help.
 
P

Pieter Wijnen

if you fire the sql the allowadditions will get bypassed
but you can also set
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
and
Me!Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

HTH Pieter

Note: it is reccommended to use the . (dot) notation instead of ! (bang) in
code, as it will at least throw an error at runtime.



redFred said:
Very good! But, I don't know how to ensure that I code properly to ensure
the new record is allowed. Help?

Pieter Wijnen said:
think we solved it there

Pieter

redFred said:
Hmmmm....maybe you gave me a hint.

Jobfrm and its subform Invoicefrm are enabled and unlocked. However --
maybe this? -- data entry is NO for Jobfrm and Invoicefrm.

This fails with 2105 "You can't go to specified record."
Me![Reservationfrm].SetFocus
Me![Reservationfrm].Form.Jobfrm.SetFocus
Me![Reservationfrm].Form.Jobfrm.Form.Invoicefrm.SetFocus

Hoping this sheds light, while I thank you for the help.
 
G

Guest

Now I am back to the original error: 2455 'You entered an expression that
has an invalid reference to the property form/report.'

Did I do the code right? Given your bang tip, this looks correct.

Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True
Me.Reservationfrm.SetFocus
Me.Reservationfrm.Form.Jobfrm.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.SetFocus

Thanks again for helping me.


Pieter Wijnen said:
if you fire the sql the allowadditions will get bypassed
but you can also set
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
and
Me!Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

HTH Pieter

Note: it is reccommended to use the . (dot) notation instead of ! (bang) in
code, as it will at least throw an error at runtime.



redFred said:
Very good! But, I don't know how to ensure that I code properly to ensure
the new record is allowed. Help?

Pieter Wijnen said:
think we solved it there

Pieter

Hmmmm....maybe you gave me a hint.

Jobfrm and its subform Invoicefrm are enabled and unlocked. However --
maybe this? -- data entry is NO for Jobfrm and Invoicefrm.

This fails with 2105 "You can't go to specified record."
Me![Reservationfrm].SetFocus
Me![Reservationfrm].Form.Jobfrm.SetFocus
Me![Reservationfrm].Form.Jobfrm.Form.Invoicefrm.SetFocus

Hoping this sheds light, while I thank you for the help.
 
P

Pieter Wijnen

On what line?
it would seem to me that one of the controls in the list is not a form after
all!
ammend to:
Me.Reservationfrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

if Reservationform *is* the MainForm reduce to:
Me.SetFocus
Me.Jobfrm.Form.SetFocus
Me.Jobfrm.Form.Invoicefrm.Form.SetFocus
Me.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

To really make sure , set a breakpoint on Set SF1= {F9} & Step through with
{F8}

Dim SF1 As Form, SF2 As Form, SF3 As Form

Set SF1 = Me.ReservationFrm.Form
Set SF2 = SF1.JobFrm.Form
Set SF3 = SF2.InvoiceFrm.Form


We must be jinxed on this one!

Pieter

redFred said:
Now I am back to the original error: 2455 'You entered an expression that
has an invalid reference to the property form/report.'

Did I do the code right? Given your bang tip, this looks correct.

Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True
Me.Reservationfrm.SetFocus

Thanks again for helping me.


Pieter Wijnen said:
if you fire the sql the allowadditions will get bypassed
but you can also set
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
and
Me!Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

HTH Pieter

Note: it is reccommended to use the . (dot) notation instead of ! (bang)
in
code, as it will at least throw an error at runtime.



redFred said:
Very good! But, I don't know how to ensure that I code properly to
ensure
the new record is allowed. Help?

:

think we solved it there

Pieter

Hmmmm....maybe you gave me a hint.

Jobfrm and its subform Invoicefrm are enabled and unlocked.
However --
maybe this? -- data entry is NO for Jobfrm and Invoicefrm.

This fails with 2105 "You can't go to specified record."
Me![Reservationfrm].SetFocus
Me![Reservationfrm].Form.Jobfrm.SetFocus
Me![Reservationfrm].Form.Jobfrm.Form.Invoicefrm.SetFocus

Hoping this sheds light, while I thank you for the help.
 
G

Guest

I think I MAY have it. A quick test seems successful, but I won't be able
to verify until later today. I'll respond then more fully.

Again, you hinted. My main form is a client form with a reservation subform
that has an invoice subform. The hint about not really a form at all caused
me to look - once again - and I saw that both Reservationfrm and Invoicefrm
were set to DataEntry = No. Reservationfrm is basically a container only so
I set it to Yes and I got expected (from code) results. Now I just have to
ensure it really does work.

I'll be back later this morning to let you know.

Thanks.

Pieter Wijnen said:
On what line?
it would seem to me that one of the controls in the list is not a form after
all!
ammend to:
Me.Reservationfrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

if Reservationform *is* the MainForm reduce to:
Me.SetFocus
Me.Jobfrm.Form.SetFocus
Me.Jobfrm.Form.Invoicefrm.Form.SetFocus
Me.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

To really make sure , set a breakpoint on Set SF1= {F9} & Step through with
{F8}

Dim SF1 As Form, SF2 As Form, SF3 As Form

Set SF1 = Me.ReservationFrm.Form
Set SF2 = SF1.JobFrm.Form
Set SF3 = SF2.InvoiceFrm.Form


We must be jinxed on this one!

Pieter

redFred said:
Now I am back to the original error: 2455 'You entered an expression that
has an invalid reference to the property form/report.'

Did I do the code right? Given your bang tip, this looks correct.

Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True
Me.Reservationfrm.SetFocus

Thanks again for helping me.


Pieter Wijnen said:
if you fire the sql the allowadditions will get bypassed
but you can also set
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
and
Me!Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

HTH Pieter

Note: it is reccommended to use the . (dot) notation instead of ! (bang)
in
code, as it will at least throw an error at runtime.



Very good! But, I don't know how to ensure that I code properly to
ensure
the new record is allowed. Help?

:

think we solved it there

Pieter

Hmmmm....maybe you gave me a hint.

Jobfrm and its subform Invoicefrm are enabled and unlocked.
However --
maybe this? -- data entry is NO for Jobfrm and Invoicefrm.

This fails with 2105 "You can't go to specified record."
Me![Reservationfrm].SetFocus
Me![Reservationfrm].Form.Jobfrm.SetFocus
Me![Reservationfrm].Form.Jobfrm.Form.Invoicefrm.SetFocus

Hoping this sheds light, while I thank you for the help.
 
G

Guest

YES! Thank you so much Pieter. I am now on the road to making it work as I
wish it to. Thanks also for sticking with me and your very prompt responses.

Fred

Pieter Wijnen said:
On what line?
it would seem to me that one of the controls in the list is not a form after
all!
ammend to:
Me.Reservationfrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.SetFocus
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

if Reservationform *is* the MainForm reduce to:
Me.SetFocus
Me.Jobfrm.Form.SetFocus
Me.Jobfrm.Form.Invoicefrm.Form.SetFocus
Me.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

To really make sure , set a breakpoint on Set SF1= {F9} & Step through with
{F8}

Dim SF1 As Form, SF2 As Form, SF3 As Form

Set SF1 = Me.ReservationFrm.Form
Set SF2 = SF1.JobFrm.Form
Set SF3 = SF2.InvoiceFrm.Form


We must be jinxed on this one!

Pieter

redFred said:
Now I am back to the original error: 2455 'You entered an expression that
has an invalid reference to the property form/report.'

Did I do the code right? Given your bang tip, this looks correct.

Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True
Me.Reservationfrm.SetFocus

Thanks again for helping me.


Pieter Wijnen said:
if you fire the sql the allowadditions will get bypassed
but you can also set
Me.Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowEdits = True
and
Me!Reservationfrm.Form.Jobfrm.Form.Invoicefrm.Form.AllowAdditions = True

HTH Pieter

Note: it is reccommended to use the . (dot) notation instead of ! (bang)
in
code, as it will at least throw an error at runtime.



Very good! But, I don't know how to ensure that I code properly to
ensure
the new record is allowed. Help?

:

think we solved it there

Pieter

Hmmmm....maybe you gave me a hint.

Jobfrm and its subform Invoicefrm are enabled and unlocked.
However --
maybe this? -- data entry is NO for Jobfrm and Invoicefrm.

This fails with 2105 "You can't go to specified record."
Me![Reservationfrm].SetFocus
Me![Reservationfrm].Form.Jobfrm.SetFocus
Me![Reservationfrm].Form.Jobfrm.Form.Invoicefrm.SetFocus

Hoping this sheds light, while I thank you for the help.
 

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

Subform goes blank 1
Subform: record select form other subform 23
set focus 2
Error 2455 behaviour 3
tabbed subform related new record. 11
.Bookmark = .RecordsetClone.Bookmark 3
format combo box 6
Can't assign value 1

Top