Need to Hard Code Date

E

Eve

Once the meeting date is typed in on the form (entered into the table) I
don't want anyone to be able to change it. I've experimented with different
options but they prevent puting in the meeting date on a new record. I'm
sure the solution is simple, I just don't know what it is and I need to fix
it by Monday.
Thanks in advance!
 
M

missinglinq via AccessMonster.com

How about:

Private Sub Form_Current()
If IsNull(Me.MeetingDate) Then
Me.MeetingDate.Locked = False
Else
Me.Meetingdate.Locked = True
End If
End Sub
 
O

Ofer Cohen

In the OnCurrent event of the form you can write the code

Me.[FieldName].Locked = Not Me.NewRecord
 
E

Eve

Thanks! This worked great, can I do it for more than one date on the form?
Obviously I'm a newbe at VB :}

Ofer said:
In the OnCurrent event of the form you can write the code

Me.[FieldName].Locked = Not Me.NewRecord
Once the meeting date is typed in on the form (entered into the table) I
don't want anyone to be able to change it. I've experimented with different
options but they prevent puting in the meeting date on a new record. I'm
sure the solution is simple, I just don't know what it is and I need to fix
it by Monday.
Thanks in advance!
 
O

Ofer Cohen

Yes, use the same way

Me.[Field1Name].Locked = Not Me.NewRecord
Me.[Field2Name].Locked = Not Me.NewRecord
Me.[Field3Name].Locked = Not Me.NewRecord

--
Good Luck
BS"D


Ofer Cohen said:
In the OnCurrent event of the form you can write the code

Me.[FieldName].Locked = Not Me.NewRecord

--
Good Luck
BS"D


Eve said:
Once the meeting date is typed in on the form (entered into the table) I
don't want anyone to be able to change it. I've experimented with different
options but they prevent puting in the meeting date on a new record. I'm
sure the solution is simple, I just don't know what it is and I need to fix
it by Monday.
Thanks in advance!
 
E

Eve

Thinking that was the logical thing to do I tried it before asking, this is
the error I get "Compile Error:
Method or Data Member not Found" I've copied and pasted the field into
[FieldName] so I'm not sure what it is looking for. It highlights Private
Sub Form_Current() in yellow and in gray it highlights .Locked=. Here is my
code:

Private Sub Form_Current()
Me.[OpenedDate].Locked = Not Me.NewRecord
Me.[ScheduledDueDate].Locked = Not Me.NewRecord
End Sub

Thanks again for your help and patience.

Ofer said:
Yes, use the same way

Me.[Field1Name].Locked = Not Me.NewRecord
Me.[Field2Name].Locked = Not Me.NewRecord
Me.[Field3Name].Locked = Not Me.NewRecord
In the OnCurrent event of the form you can write the code
[quoted text clipped - 6 lines]
 
O

Ofer Cohen

Is ScheduledDueDate the correct field name?

Type
Me.

when you get the list of fields do you get the ScheduledDueDate name?
Mybe you copied the name of the lable and not the text box.

--
Good Luck
BS"D


Eve said:
Thinking that was the logical thing to do I tried it before asking, this is
the error I get "Compile Error:
Method or Data Member not Found" I've copied and pasted the field into
[FieldName] so I'm not sure what it is looking for. It highlights Private
Sub Form_Current() in yellow and in gray it highlights .Locked=. Here is my
code:

Private Sub Form_Current()
Me.[OpenedDate].Locked = Not Me.NewRecord
Me.[ScheduledDueDate].Locked = Not Me.NewRecord
End Sub

Thanks again for your help and patience.

Ofer said:
Yes, use the same way

Me.[Field1Name].Locked = Not Me.NewRecord
Me.[Field2Name].Locked = Not Me.NewRecord
Me.[Field3Name].Locked = Not Me.NewRecord
In the OnCurrent event of the form you can write the code
[quoted text clipped - 6 lines]
it by Monday.
Thanks in advance!
 
F

fredg

Once the meeting date is typed in on the form (entered into the table) I
don't want anyone to be able to change it. I've experimented with different
options but they prevent puting in the meeting date on a new record. I'm
sure the solution is simple, I just don't know what it is and I need to fix
it by Monday.
Thanks in advance!

Code the Form's Current event:

Me![MeetingDate].Locked = Me.NewRecord = False

Once you create and leave that new record, you will not be able to
change the date (using the form).
 
E

Eve

Yes, the label for OpenedDate is Meeting Date and the label for
ScheduledDueDate is Original Due Date. The client changed her mind.

Ofer said:
Is ScheduledDueDate the correct field name?

Type
Me.

when you get the list of fields do you get the ScheduledDueDate name?
Mybe you copied the name of the lable and not the text box.
Thinking that was the logical thing to do I tried it before asking, this is
the error I get "Compile Error:
[quoted text clipped - 21 lines]
 
E

Eve

This worked great the Meeting Date (OpenedDate is the field name.) But I'd
also like to do it for the End Date (ScheduledDueDate is the field name.) If
you see above I get an error when I do them both. Your thoughts?
Once the meeting date is typed in on the form (entered into the table) I
don't want anyone to be able to change it. I've experimented with different
options but they prevent puting in the meeting date on a new record. I'm
sure the solution is simple, I just don't know what it is and I need to fix
it by Monday.
Thanks in advance!

Code the Form's Current event:

Me![MeetingDate].Locked = Me.NewRecord = False

Once you create and leave that new record, you will not be able to
change the date (using the form).
 
S

SteveS

Hi Eve,

You should use the name of the control, not the name of the bound field.

If you add an *unbound* control, like a text box, Access will name the text
box something like "Text3".

If you add an *bound* control with the bound fieldname of
"ScheduledDueDate", Access will name the text box "ScheduledDueDate" (the
name of the control is the same as the name of the field it is bound to).

In design view of the form, select the textbox control (NOT the label), open
properties, then click on the "Other" tab. The top line is the name of the
control - this is what you should use in the code that Ofer provided.

EXAMPLE: If the textbox is named "Text21" and the field it is bound to is
"ScheduledDueDate", you should use:

Me.[Text21].Locked = Not Me.NewRecord


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Eve said:
Thinking that was the logical thing to do I tried it before asking, this is
the error I get "Compile Error:
Method or Data Member not Found" I've copied and pasted the field into
[FieldName] so I'm not sure what it is looking for. It highlights Private
Sub Form_Current() in yellow and in gray it highlights .Locked=. Here is my
code:

Private Sub Form_Current()
Me.[OpenedDate].Locked = Not Me.NewRecord
Me.[ScheduledDueDate].Locked = Not Me.NewRecord
End Sub

Thanks again for your help and patience.

Ofer said:
Yes, use the same way

Me.[Field1Name].Locked = Not Me.NewRecord
Me.[Field2Name].Locked = Not Me.NewRecord
Me.[Field3Name].Locked = Not Me.NewRecord
In the OnCurrent event of the form you can write the code
[quoted text clipped - 6 lines]
it by Monday.
Thanks in advance!
 
E

Eve via AccessMonster.com

The error I get "Compile Error: Method or Data Member not Found"

Private Sub Form_Current()
Me.[OpenedDate].Locked = Not Me.NewRecord
Me.[ScheduledDueDate].Locked = Not Me.NewRecord
End Sub

The problem is when I put the . after ScheduledDueDate the only thing that
shows is "Value" (not "Locked" and the list that appeared when I did the
OpenedDate.

Thanks again for your help and patience.



Hi Eve,

You should use the name of the control, not the name of the bound field.

If you add an *unbound* control, like a text box, Access will name the text
box something like "Text3".

If you add an *bound* control with the bound fieldname of
"ScheduledDueDate", Access will name the text box "ScheduledDueDate" (the
name of the control is the same as the name of the field it is bound to).

In design view of the form, select the textbox control (NOT the label), open
properties, then click on the "Other" tab. The top line is the name of the
control - this is what you should use in the code that Ofer provided.

EXAMPLE: If the textbox is named "Text21" and the field it is bound to is
"ScheduledDueDate", you should use:

Me.[Text21].Locked = Not Me.NewRecord

HTH
Thinking that was the logical thing to do I tried it before asking, this is
the error I get "Compile Error:
[quoted text clipped - 21 lines]
 
D

Douglas J. Steele

Is ScheduledDueDate a control on your form, or strictly a field in the
form's RecordSource?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Eve via AccessMonster.com said:
The error I get "Compile Error: Method or Data Member not Found"

Private Sub Form_Current()
Me.[OpenedDate].Locked = Not Me.NewRecord
Me.[ScheduledDueDate].Locked = Not Me.NewRecord
End Sub

The problem is when I put the . after ScheduledDueDate the only thing that
shows is "Value" (not "Locked" and the list that appeared when I did the
OpenedDate.

Thanks again for your help and patience.



Hi Eve,

You should use the name of the control, not the name of the bound field.

If you add an *unbound* control, like a text box, Access will name the
text
box something like "Text3".

If you add an *bound* control with the bound fieldname of
"ScheduledDueDate", Access will name the text box "ScheduledDueDate" (the
name of the control is the same as the name of the field it is bound to).

In design view of the form, select the textbox control (NOT the label),
open
properties, then click on the "Other" tab. The top line is the name of the
control - this is what you should use in the code that Ofer provided.

EXAMPLE: If the textbox is named "Text21" and the field it is bound to is
"ScheduledDueDate", you should use:

Me.[Text21].Locked = Not Me.NewRecord

HTH
Thinking that was the logical thing to do I tried it before asking, this
is
the error I get "Compile Error:
[quoted text clipped - 21 lines]
it by Monday.
Thanks in advance!
 
S

SteveS

Again, use the name of the *control*, NOT the name of the bound field.


I tried the name of the bound field (the field name in a table) in a test
mdb and got the same error.

Check the name of the control...

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Eve via AccessMonster.com said:
The error I get "Compile Error: Method or Data Member not Found"

Private Sub Form_Current()
Me.[OpenedDate].Locked = Not Me.NewRecord
Me.[ScheduledDueDate].Locked = Not Me.NewRecord
End Sub

The problem is when I put the . after ScheduledDueDate the only thing that
shows is "Value" (not "Locked" and the list that appeared when I did the
OpenedDate.

Thanks again for your help and patience.



Hi Eve,

You should use the name of the control, not the name of the bound field.

If you add an *unbound* control, like a text box, Access will name the text
box something like "Text3".

If you add an *bound* control with the bound fieldname of
"ScheduledDueDate", Access will name the text box "ScheduledDueDate" (the
name of the control is the same as the name of the field it is bound to).

In design view of the form, select the textbox control (NOT the label), open
properties, then click on the "Other" tab. The top line is the name of the
control - this is what you should use in the code that Ofer provided.

EXAMPLE: If the textbox is named "Text21" and the field it is bound to is
"ScheduledDueDate", you should use:

Me.[Text21].Locked = Not Me.NewRecord

HTH
Thinking that was the logical thing to do I tried it before asking, this is
the error I get "Compile Error:
[quoted text clipped - 21 lines]
it by Monday.
Thanks in advance!
 
E

Eve via AccessMonster.com

It is the control source and the bound field, just like OpenedDate.
Is ScheduledDueDate a control on your form, or strictly a field in the
form's RecordSource?
The error I get "Compile Error: Method or Data Member not Found"
[quoted text clipped - 38 lines]
 
E

Eve via AccessMonster.com

Aren't the control source and the bound field the same? I did it the same
way for OpenedDate and got all those choices (including Locked) but only
"value" for ScheduledDueDate. Everything about the two dates has been set
the same, where else do I look for the control?
Thanks!
Again, use the name of the *control*, NOT the name of the bound field.

I tried the name of the bound field (the field name in a table) in a test
mdb and got the same error.

Check the name of the control...
The error I get "Compile Error: Method or Data Member not Found"
[quoted text clipped - 35 lines]
 
O

Ofer Cohen

Sometimes the control source and the name of the control are the same.

It should be name of the control and not the name of the field in the
ControlSource, (unless they are the same probably like OpenedDate)

Check the name of the control (Text Box)


--
Good Luck
BS"D


Eve via AccessMonster.com said:
It is the control source and the bound field, just like OpenedDate.
Is ScheduledDueDate a control on your form, or strictly a field in the
form's RecordSource?
The error I get "Compile Error: Method or Data Member not Found"
[quoted text clipped - 38 lines]
it by Monday.
Thanks in advance!
 
E

Eve via AccessMonster.com

Thank you so much, that did it. My client has changed her mind so many times.
..the control was DueDate and the bound field was ScheduledDueDate. Not
being a VB guru I had no clue what a difference it would make. Problem
solved and I am good to go! Have a great weekend.

Ofer said:
Sometimes the control source and the name of the control are the same.

It should be name of the control and not the name of the field in the
ControlSource, (unless they are the same probably like OpenedDate)

Check the name of the control (Text Box)
It is the control source and the bound field, just like OpenedDate.
[quoted text clipped - 6 lines]
 
Top