Run-time error 438?

D

Dustin

Hello,

I am trying to create an edit control for my form. I lock my textboxes in
properties and then I created a command button with an event on onclick.

My codes are working for most of them expect a few. When I click the button
it gives me Run-time error 438. My code is based liked this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)
Me![Machine Repair Date].Locked = False
Me![Total Labor hrs].Locked = False
Me![Warranty Claim Date].Locked = False
End Sub

I am just starting to try coding so any help would be greatly appreciated.

Thanks Dustin
 
D

Douglas J. Steele

Error 438 is "Object doesn't support this property or method."

Are you sure Part Fail Date is a text box and not, say, a label?
 
D

Dirk Goldgar

In
Dustin said:
Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with an
event on onclick.

My codes are working for most of them expect a few. When I click the
button it gives me Run-time error 438. My code is based liked this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is it
possible that it's a label?
 
D

Dustin

Thanks for responding guys.

I am typing in the control source name that is in the properties? And that
is what I have typed in to the table in Design View. Am I miss understanding
you guys or am I on the right track? If I am on the right track what do I
check for next?

Thanks alot

Dustin

Dirk Goldgar said:
In
Dustin said:
Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with an
event on onclick.

My codes are working for most of them expect a few. When I click the
button it gives me Run-time error 438. My code is based liked this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Douglas J. Steele

You still haven't confirmed that the control in question is a text box (or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in the Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in it) and
then change Me![Part Fail Date].Locked = False to reflect the new control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks for responding guys.

I am typing in the control source name that is in the properties? And that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track what do I
check for next?

Thanks alot

Dustin

Dirk Goldgar said:
In
Dustin said:
Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with an
event on onclick.

My codes are working for most of them expect a few. When I click the
button it gives me Run-time error 438. My code is based liked this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dustin

Thanks, I got it to work and I understand what I did wrong I need to use the
name of the textbox and not the control source name. See I named them
different for some reason. Why is should I not use spaces? Just curious so I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

Douglas J. Steele said:
You still haven't confirmed that the control in question is a text box (or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in the Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in it) and
then change Me![Part Fail Date].Locked = False to reflect the new control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks for responding guys.

I am typing in the control source name that is in the properties? And that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track what do I
check for next?

Thanks alot

Dustin

Dirk Goldgar said:
In Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with an
event on onclick.

My codes are working for most of them expect a few. When I click the
button it gives me Run-time error 438. My code is based liked this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Douglas J. Steele

Spaces can cause problems when referring to fields or controls: it's a
nuisance to always have to enclose them in quotes or square brackets. Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks, I got it to work and I understand what I did wrong I need to use
the
name of the textbox and not the control source name. See I named them
different for some reason. Why is should I not use spaces? Just curious so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

Douglas J. Steele said:
You still haven't confirmed that the control in question is a text box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in it)
and
then change Me![Part Fail Date].Locked = False to reflect the new control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks for responding guys.

I am typing in the control source name that is in the properties? And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track what do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with an
event on onclick.

My codes are working for most of them expect a few. When I click the
button it gives me Run-time error 438. My code is based liked this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dustin

I see, I will do that from now on. My last question from my last post might
have been missed. I wasn't sure on what was the best way to reverse the edit
button's command when I go to a new record?

Thanks Dustin

Douglas J. Steele said:
Spaces can cause problems when referring to fields or controls: it's a
nuisance to always have to enclose them in quotes or square brackets. Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks, I got it to work and I understand what I did wrong I need to use
the
name of the textbox and not the control source name. See I named them
different for some reason. Why is should I not use spaces? Just curious so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

Douglas J. Steele said:
You still haven't confirmed that the control in question is a text box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in it)
and
then change Me![Part Fail Date].Locked = False to reflect the new control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for responding guys.

I am typing in the control source name that is in the properties? And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track what do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with an
event on onclick.

My codes are working for most of them expect a few. When I click the
button it gives me Run-time error 438. My code is based liked this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Douglas J. Steele

You'll have to put code in the form's Current event to reset the Locked
properties.

If you only want the properties reset for new records, use the form's
NewRecord property:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
I see, I will do that from now on. My last question from my last post might
have been missed. I wasn't sure on what was the best way to reverse the
edit
button's command when I go to a new record?

Thanks Dustin

Douglas J. Steele said:
Spaces can cause problems when referring to fields or controls: it's a
nuisance to always have to enclose them in quotes or square brackets.
Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks, I got it to work and I understand what I did wrong I need to
use
the
name of the textbox and not the control source name. See I named them
different for some reason. Why is should I not use spaces? Just curious
so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

:

You still haven't confirmed that the control in question is a text box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in
it)
and
then change Me![Part Fail Date].Locked = False to reflect the new
control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for responding guys.

I am typing in the control source name that is in the properties?
And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track what
do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with
an
event on onclick.

My codes are working for most of them expect a few. When I click
the
button it gives me Run-time error 438. My code is based liked
this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is
it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dustin

I'm sorry, I ment to say next record or any time I left to another record I
would want it to auto lock. I want to be able to type when I enter a new
record. So what would be different from what you told me last post?

Thanks Dustin

Douglas J. Steele said:
You'll have to put code in the form's Current event to reset the Locked
properties.

If you only want the properties reset for new records, use the form's
NewRecord property:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
I see, I will do that from now on. My last question from my last post might
have been missed. I wasn't sure on what was the best way to reverse the
edit
button's command when I go to a new record?

Thanks Dustin

Douglas J. Steele said:
Spaces can cause problems when referring to fields or controls: it's a
nuisance to always have to enclose them in quotes or square brackets.
Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks, I got it to work and I understand what I did wrong I need to
use
the
name of the textbox and not the control source name. See I named them
different for some reason. Why is should I not use spaces? Just curious
so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

:

You still haven't confirmed that the control in question is a text box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in
it)
and
then change Me![Part Fail Date].Locked = False to reflect the new
control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for responding guys.

I am typing in the control source name that is in the properties?
And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track what
do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button with
an
event on onclick.

My codes are working for most of them expect a few. When I click
the
button it gives me Run-time error 438. My code is based liked
this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger says)

Are you sure that the control [Part Fail Date] is a text box? Is
it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Douglas J. Steele

Are you saying you always want existing records locked, and only new ones
unlocked?

If so, try:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub

or

Private Sub Form_Current()

Me![Drago ID].Locked = Not Me.NewRecord
Me![Drago Claim Number].Locked = Not Me.NewRecord
....

End Sub

On the other hand, if you only want them locked if you've clicked on the
button to lock them in the first place, it's a slightly more complicated
proposition (but not that much worse). The trick is, you need to know
whether or not you've already locked the controls. You can put a check box
on the form (it doesn't have to be visible), and use that to control the
locking. Assuming you named the check box txtLocked (and that it's True when
they're supposed to be locked, and False when they're supposed to be
unlocked), you can use something like:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = Me.txtLocked
Me![Drago Claim Number].Locked = Me.txtLocked
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
I'm sorry, I ment to say next record or any time I left to another record
I
would want it to auto lock. I want to be able to type when I enter a new
record. So what would be different from what you told me last post?

Thanks Dustin

Douglas J. Steele said:
You'll have to put code in the form's Current event to reset the Locked
properties.

If you only want the properties reset for new records, use the form's
NewRecord property:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
I see, I will do that from now on. My last question from my last post
might
have been missed. I wasn't sure on what was the best way to reverse the
edit
button's command when I go to a new record?

Thanks Dustin

:

Spaces can cause problems when referring to fields or controls: it's a
nuisance to always have to enclose them in quotes or square brackets.
Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail
Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks, I got it to work and I understand what I did wrong I need to
use
the
name of the textbox and not the control source name. See I named
them
different for some reason. Why is should I not use spaces? Just
curious
so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

:

You still haven't confirmed that the control in question is a text
box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in
the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in
it)
and
then change Me![Part Fail Date].Locked = False to reflect the new
control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for responding guys.

I am typing in the control source name that is in the properties?
And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track
what
do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button
with
an
event on onclick.

My codes are working for most of them expect a few. When I
click
the
button it gives me Run-time error 438. My code is based liked
this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger
says)

Are you sure that the control [Part Fail Date] is a text box?
Is
it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dustin

Thanks for the last post I will give that a try. But a new problem arose, I
think it is because I am now edit controlling the subform. And I suppose that
I need to tell it what subform the fields are in?

Me![PartsNumber].Locked = False (is in the subform)

Do I need to add !Forms! then the name of the subform somewhere in this code?

Thanks Dustin

Douglas J. Steele said:
Are you saying you always want existing records locked, and only new ones
unlocked?

If so, try:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub

or

Private Sub Form_Current()

Me![Drago ID].Locked = Not Me.NewRecord
Me![Drago Claim Number].Locked = Not Me.NewRecord
....

End Sub

On the other hand, if you only want them locked if you've clicked on the
button to lock them in the first place, it's a slightly more complicated
proposition (but not that much worse). The trick is, you need to know
whether or not you've already locked the controls. You can put a check box
on the form (it doesn't have to be visible), and use that to control the
locking. Assuming you named the check box txtLocked (and that it's True when
they're supposed to be locked, and False when they're supposed to be
unlocked), you can use something like:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = Me.txtLocked
Me![Drago Claim Number].Locked = Me.txtLocked
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
I'm sorry, I ment to say next record or any time I left to another record
I
would want it to auto lock. I want to be able to type when I enter a new
record. So what would be different from what you told me last post?

Thanks Dustin

Douglas J. Steele said:
You'll have to put code in the form's Current event to reset the Locked
properties.

If you only want the properties reset for new records, use the form's
NewRecord property:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I see, I will do that from now on. My last question from my last post
might
have been missed. I wasn't sure on what was the best way to reverse the
edit
button's command when I go to a new record?

Thanks Dustin

:

Spaces can cause problems when referring to fields or controls: it's a
nuisance to always have to enclose them in quotes or square brackets.
Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail
Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks, I got it to work and I understand what I did wrong I need to
use
the
name of the textbox and not the control source name. See I named
them
different for some reason. Why is should I not use spaces? Just
curious
so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

:

You still haven't confirmed that the control in question is a text
box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say in
the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces in
it)
and
then change Me![Part Fail Date].Locked = False to reflect the new
control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for responding guys.

I am typing in the control source name that is in the properties?
And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right track
what
do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock my
textboxes in properties and then I created a command button
with
an
event on onclick.

My codes are working for most of them expect a few. When I
click
the
button it gives me Run-time error 438. My code is based liked
this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger
says)

Are you sure that the control [Part Fail Date] is a text box?
Is
it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Douglas J. Steele

To refer to controls on a subform from the parent form, you use:

Me!NameOfSubformControl.Form!NameOfControl

Depending on how you added the form as a subform on the parent form, the
name of the subform control on the parent form may be different than the
name of the form being used as a subform.

For more details about dealing with forms and subforms, see
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks for the last post I will give that a try. But a new problem arose,
I
think it is because I am now edit controlling the subform. And I suppose
that
I need to tell it what subform the fields are in?

Me![PartsNumber].Locked = False (is in the subform)

Do I need to add !Forms! then the name of the subform somewhere in this
code?

Thanks Dustin

Douglas J. Steele said:
Are you saying you always want existing records locked, and only new ones
unlocked?

If so, try:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub

or

Private Sub Form_Current()

Me![Drago ID].Locked = Not Me.NewRecord
Me![Drago Claim Number].Locked = Not Me.NewRecord
....

End Sub

On the other hand, if you only want them locked if you've clicked on the
button to lock them in the first place, it's a slightly more complicated
proposition (but not that much worse). The trick is, you need to know
whether or not you've already locked the controls. You can put a check
box
on the form (it doesn't have to be visible), and use that to control the
locking. Assuming you named the check box txtLocked (and that it's True
when
they're supposed to be locked, and False when they're supposed to be
unlocked), you can use something like:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = Me.txtLocked
Me![Drago Claim Number].Locked = Me.txtLocked
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
I'm sorry, I ment to say next record or any time I left to another
record
I
would want it to auto lock. I want to be able to type when I enter a
new
record. So what would be different from what you told me last post?

Thanks Dustin

:

You'll have to put code in the form's Current event to reset the
Locked
properties.

If you only want the properties reset for new records, use the form's
NewRecord property:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I see, I will do that from now on. My last question from my last post
might
have been missed. I wasn't sure on what was the best way to reverse
the
edit
button's command when I go to a new record?

Thanks Dustin

:

Spaces can cause problems when referring to fields or controls:
it's a
nuisance to always have to enclose them in quotes or square
brackets.
Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail
Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks, I got it to work and I understand what I did wrong I need
to
use
the
name of the textbox and not the control source name. See I named
them
different for some reason. Why is should I not use spaces? Just
curious
so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

:

You still haven't confirmed that the control in question is a
text
box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say
in
the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces
in
it)
and
then change Me![Part Fail Date].Locked = False to reflect the
new
control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for responding guys.

I am typing in the control source name that is in the
properties?
And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right
track
what
do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock
my
textboxes in properties and then I created a command button
with
an
event on onclick.

My codes are working for most of them expect a few. When I
click
the
button it gives me Run-time error 438. My code is based
liked
this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger
says)

Are you sure that the control [Part Fail Date] is a text box?
Is
it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dustin

Thanks for all your help

Dustin

Douglas J. Steele said:
To refer to controls on a subform from the parent form, you use:

Me!NameOfSubformControl.Form!NameOfControl

Depending on how you added the form as a subform on the parent form, the
name of the subform control on the parent form may be different than the
name of the form being used as a subform.

For more details about dealing with forms and subforms, see
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dustin said:
Thanks for the last post I will give that a try. But a new problem arose,
I
think it is because I am now edit controlling the subform. And I suppose
that
I need to tell it what subform the fields are in?

Me![PartsNumber].Locked = False (is in the subform)

Do I need to add !Forms! then the name of the subform somewhere in this
code?

Thanks Dustin

Douglas J. Steele said:
Are you saying you always want existing records locked, and only new ones
unlocked?

If so, try:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub

or

Private Sub Form_Current()

Me![Drago ID].Locked = Not Me.NewRecord
Me![Drago Claim Number].Locked = Not Me.NewRecord
....

End Sub

On the other hand, if you only want them locked if you've clicked on the
button to lock them in the first place, it's a slightly more complicated
proposition (but not that much worse). The trick is, you need to know
whether or not you've already locked the controls. You can put a check
box
on the form (it doesn't have to be visible), and use that to control the
locking. Assuming you named the check box txtLocked (and that it's True
when
they're supposed to be locked, and False when they're supposed to be
unlocked), you can use something like:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
....
Else
Me![Drago ID].Locked = Me.txtLocked
Me![Drago Claim Number].Locked = Me.txtLocked
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I'm sorry, I ment to say next record or any time I left to another
record
I
would want it to auto lock. I want to be able to type when I enter a
new
record. So what would be different from what you told me last post?

Thanks Dustin

:

You'll have to put code in the form's Current event to reset the
Locked
properties.

If you only want the properties reset for new records, use the form's
NewRecord property:

Private Sub Form_Current()

If Me.NewRecord Then
Me![Drago ID].Locked = True
Me![Drago Claim Number].Locked = True
....
End If

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I see, I will do that from now on. My last question from my last post
might
have been missed. I wasn't sure on what was the best way to reverse
the
edit
button's command when I go to a new record?

Thanks Dustin

:

Spaces can cause problems when referring to fields or controls:
it's a
nuisance to always have to enclose them in quotes or square
brackets.
Most
of us prefer using Camel Case (PartFailDate, rather than Part Fail
Date).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks, I got it to work and I understand what I did wrong I need
to
use
the
name of the textbox and not the control source name. See I named
them
different for some reason. Why is should I not use spaces? Just
curious
so
I
understand.

And how do I code it so that when I go to a new record the lock
automatically comes back on?

Thanks so much,

Dustin

:

You still haven't confirmed that the control in question is a
text
box
(or
other control that has a Locked property).

When you're looking in the Properties dialog, what does it say
in
the
Title
of the dialog (the coloured bar above the tabs)?

Try renaming the control (preferably to something without spaces
in
it)
and
then change Me![Part Fail Date].Locked = False to reflect the
new
control
name. Does that make a difference?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for responding guys.

I am typing in the control source name that is in the
properties?
And
that
is what I have typed in to the table in Design View. Am I miss
understanding
you guys or am I on the right track? If I am on the right
track
what
do
I
check for next?

Thanks alot

Dustin

:

In Hello,

I am trying to create an edit control for my form. I lock
my
textboxes in properties and then I created a command button
with
an
event on onclick.

My codes are working for most of them expect a few. When I
click
the
button it gives me Run-time error 438. My code is based
liked
this.

Me![Control].Locked=False

Private Sub Edit_Record_Click()
Me![Drago ID].Locked = False
Me![Drago Claim Number].Locked = False
Me![Dealer Claim Number].Locked = False
Me![Dealer].Locked = False
Me![Store].Locked = False
Me![Machine Acres].Locked = False
Me![Part Fail Date].Locked = False - NOT WORKING (debuger
says)

Are you sure that the control [Part Fail Date] is a text box?
Is
it
possible that it's a label?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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

Top