Run-time error 438?

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


0
Utf
6/3/2007 4:06:02 PM
access 16762 articles. 3 followers. Follow

13 Replies
1591 Views

Similar Articles

[PageSpeed] 13

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?


-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Dustin" <Dustin@discussions.microsoft.com> wrote in message 
news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com...
> 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
>
> 


0
Douglas
6/3/2007 4:20:45 PM
In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
Dustin <Dustin@discussions.microsoft.com> wrote:
> 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)


0
Dirk
6/3/2007 4:22:16 PM
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" wrote:

> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
> Dustin <Dustin@discussions.microsoft.com> wrote:
> > 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)
> 
> 
> 
0
Utf
6/4/2007 2:55:01 PM
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
http://I.Am/DougSteele
(no e-mails, please!)


"Dustin" <Dustin@discussions.microsoft.com> wrote in message 
news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
> 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" wrote:
>
>> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
>> Dustin <Dustin@discussions.microsoft.com> wrote:
>> > 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)
>>
>>
>> 


0
Douglas
6/4/2007 3:02:48 PM
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" wrote:

> 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
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "Dustin" <Dustin@discussions.microsoft.com> wrote in message 
> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
> > 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" wrote:
> >
> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
> >> Dustin <Dustin@discussions.microsoft.com> wrote:
> >> > 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)
> >>
> >>
> >> 
> 
> 
> 
0
Utf
6/4/2007 5:06:00 PM
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
http://I.Am/DougSteele
(no e-mails, please!)


"Dustin" <Dustin@discussions.microsoft.com> wrote in message 
news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
> 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" wrote:
>
>> 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
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
>> > 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" wrote:
>> >
>> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
>> >> Dustin <Dustin@discussions.microsoft.com> wrote:
>> >> > 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)
>> >>
>> >>
>> >>
>>
>>
>> 


0
Douglas
6/4/2007 5:24:18 PM
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" wrote:

> 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
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "Dustin" <Dustin@discussions.microsoft.com> wrote in message 
> news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
> > 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" wrote:
> >
> >> 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
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
> >> > 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" wrote:
> >> >
> >> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
> >> >> Dustin <Dustin@discussions.microsoft.com> wrote:
> >> >> > 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)
> >> >>
> >> >>
> >> >>
> >>
> >>
> >> 
> 
> 
> 
0
Utf
6/4/2007 5:47:01 PM
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
http://I.Am/DougSteele
(no e-mails, please!)


"Dustin" <Dustin@discussions.microsoft.com> wrote in message 
news:71DA2668-4B22-4E0B-A635-3EC2E247DCA9@microsoft.com...
>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" wrote:
>
>> 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
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
>> > 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" wrote:
>> >
>> >> 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
>> >> http://I.Am/DougSteele
>> >> (no e-mails, please!)
>> >>
>> >>
>> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> >> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
>> >> > 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" wrote:
>> >> >
>> >> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
>> >> >> Dustin <Dustin@discussions.microsoft.com> wrote:
>> >> >> > 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)
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>> 


0
Douglas
6/4/2007 6:05:09 PM
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" wrote:

> 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
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "Dustin" <Dustin@discussions.microsoft.com> wrote in message 
> news:71DA2668-4B22-4E0B-A635-3EC2E247DCA9@microsoft.com...
> >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" wrote:
> >
> >> 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
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
> >> > 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" wrote:
> >> >
> >> >> 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
> >> >> http://I.Am/DougSteele
> >> >> (no e-mails, please!)
> >> >>
> >> >>
> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> >> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
> >> >> > 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" wrote:
> >> >> >
> >> >> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
> >> >> >> Dustin <Dustin@discussions.microsoft.com> wrote:
> >> >> >> > 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)
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >> 
> 
> 
> 
0
Utf
6/4/2007 6:23:01 PM
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
http://I.Am/DougSteele
(no e-mails, please!)


"Dustin" <Dustin@discussions.microsoft.com> wrote in message 
news:0C75B8BE-E6E9-4CA1-9C64-C866308FD137@microsoft.com...
> 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" wrote:
>
>> 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
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> news:71DA2668-4B22-4E0B-A635-3EC2E247DCA9@microsoft.com...
>> >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" wrote:
>> >
>> >> 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
>> >> http://I.Am/DougSteele
>> >> (no e-mails, please!)
>> >>
>> >>
>> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> >> news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
>> >> > 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" wrote:
>> >> >
>> >> >> 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
>> >> >> http://I.Am/DougSteele
>> >> >> (no e-mails, please!)
>> >> >>
>> >> >>
>> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> >> >> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
>> >> >> > 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" wrote:
>> >> >> >
>> >> >> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
>> >> >> >> Dustin <Dustin@discussions.microsoft.com> wrote:
>> >> >> >> > 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)
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>> 


0
Douglas
6/4/2007 6:35:06 PM
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" wrote:

> 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
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "Dustin" <Dustin@discussions.microsoft.com> wrote in message 
> news:0C75B8BE-E6E9-4CA1-9C64-C866308FD137@microsoft.com...
> > 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" wrote:
> >
> >> 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
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> news:71DA2668-4B22-4E0B-A635-3EC2E247DCA9@microsoft.com...
> >> >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" wrote:
> >> >
> >> >> 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
> >> >> http://I.Am/DougSteele
> >> >> (no e-mails, please!)
> >> >>
> >> >>
> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> >> news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
> >> >> > 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" wrote:
> >> >> >
> >> >> >> 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
> >> >> >> http://I.Am/DougSteele
> >> >> >> (no e-mails, please!)
> >> >> >>
> >> >> >>
> >> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> >> >> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
> >> >> >> > 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" wrote:
> >> >> >> >
> >> >> >> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
> >> >> >> >> Dustin <Dustin@discussions.microsoft.com> wrote:
> >> >> >> >> > 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)
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >> 
> 
> 
> 
0
Utf
6/4/2007 7:15:00 PM
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
http://I.Am/DougSteele
(no e-mails, please!)


"Dustin" <Dustin@discussions.microsoft.com> wrote in message 
news:F37C58AD-09A2-4A39-8879-DD3D9DA569CB@microsoft.com...
> 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" wrote:
>
>> 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
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> news:0C75B8BE-E6E9-4CA1-9C64-C866308FD137@microsoft.com...
>> > 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" wrote:
>> >
>> >> 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
>> >> http://I.Am/DougSteele
>> >> (no e-mails, please!)
>> >>
>> >>
>> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> >> news:71DA2668-4B22-4E0B-A635-3EC2E247DCA9@microsoft.com...
>> >> >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" wrote:
>> >> >
>> >> >> 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
>> >> >> http://I.Am/DougSteele
>> >> >> (no e-mails, please!)
>> >> >>
>> >> >>
>> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> >> >> news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
>> >> >> > 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" wrote:
>> >> >> >
>> >> >> >> 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
>> >> >> >> http://I.Am/DougSteele
>> >> >> >> (no e-mails, please!)
>> >> >> >>
>> >> >> >>
>> >> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
>> >> >> >> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
>> >> >> >> > 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" wrote:
>> >> >> >> >
>> >> >> >> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
>> >> >> >> >> Dustin <Dustin@discussions.microsoft.com> wrote:
>> >> >> >> >> > 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)
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>> 


0
Douglas
6/4/2007 7:43:44 PM
Thanks for all your help

Dustin

"Douglas J. Steele" wrote:

> 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
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "Dustin" <Dustin@discussions.microsoft.com> wrote in message 
> news:F37C58AD-09A2-4A39-8879-DD3D9DA569CB@microsoft.com...
> > 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" wrote:
> >
> >> 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
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> news:0C75B8BE-E6E9-4CA1-9C64-C866308FD137@microsoft.com...
> >> > 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" wrote:
> >> >
> >> >> 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
> >> >> http://I.Am/DougSteele
> >> >> (no e-mails, please!)
> >> >>
> >> >>
> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> >> news:71DA2668-4B22-4E0B-A635-3EC2E247DCA9@microsoft.com...
> >> >> >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" wrote:
> >> >> >
> >> >> >> 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
> >> >> >> http://I.Am/DougSteele
> >> >> >> (no e-mails, please!)
> >> >> >>
> >> >> >>
> >> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> >> >> news:B6C21238-6613-4DE6-B0CC-12ECD4971FA3@microsoft.com...
> >> >> >> > 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" wrote:
> >> >> >> >
> >> >> >> >> 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
> >> >> >> >> http://I.Am/DougSteele
> >> >> >> >> (no e-mails, please!)
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> "Dustin" <Dustin@discussions.microsoft.com> wrote in message
> >> >> >> >> news:C878FF40-E9C5-45B6-AD42-969CFC6848FC@microsoft.com...
> >> >> >> >> > 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" wrote:
> >> >> >> >> >
> >> >> >> >> >> In news:2B297684-DE26-4F1B-8EF9-D5E4B9124C8B@microsoft.com,
> >> >> >> >> >> Dustin <Dustin@discussions.microsoft.com> wrote:
> >> >> >> >> >> > 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)
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >> 
> 
> 
> 
0
Utf
6/5/2007 12:06:00 AM
Reply:

Similar Artilces: