how can i hide text box when not on new record?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a text box that displays one date, that is, the next date of the next
record that needs to be created. i.e. records should be created in date
order.
so the text box is based on a query that adds 1 to the date of the record
with the max date.

when a user clicks on the date in the text box, the date field on the form
is populated and a macro runs which among other things, creates the record.
the user continues to enter the data into the remaining fields on the form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box when not
on a new record and therefore unknowingly changing the date of an existing
record or even if he realizes that he made a mistakenly changed the date
before closing the form or going to a different record he may not remember
what the original date of the record was.
 
To show a text box only when you are at a new record, add this to the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord
 
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something wrong.

"...add this to the current event procedure" -- are you referring to
--design view of form, then select form, then properties- "on current" ???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on the "on
current" line of the form properities????

thank you

Allen Browne said:
To show a text box only when you are at a new record, add this to the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
i have a text box that displays one date, that is, the next date of the
next
record that needs to be created. i.e. records should be created in date
order.
so the text box is based on a query that adds 1 to the date of the record
with the max date.

when a user clicks on the date in the text box, the date field on the form
is populated and a macro runs which among other things, creates the
record.
the user continues to enter the data into the remaining fields on the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box when not
on a new record and therefore unknowingly changing the date of an existing
record or even if he realizes that he made a mistakenly changed the date
before closing the form or going to a different record he may not remember
what the original date of the record was.
 
1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current property to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties of a text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2 lines of
code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something wrong.

"...add this to the current event procedure" -- are you referring to
--design view of form, then select form, then properties- "on current" ???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on the "on
current" line of the form properities????

thank you

Allen Browne said:
To show a text box only when you are at a new record, add this to the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

bettyboopbh said:
i have a text box that displays one date, that is, the next date of the
next
record that needs to be created. i.e. records should be created in
date
order.
so the text box is based on a query that adds 1 to the date of the
record
with the max date.

when a user clicks on the date in the text box, the date field on the
form
is populated and a macro runs which among other things, creates the
record.
the user continues to enter the data into the remaining fields on the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box when
not
on a new record and therefore unknowingly changing the date of an
existing
record or even if he realizes that he made a mistakenly changed the
date
before closing the form or going to a different record he may not
remember
what the original date of the record was.
 
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with actual name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current" line.
can i run the macro and the code you provided?? can i combine them some
way??

thanks for your help



Allen Browne said:
1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current property to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties of a text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2 lines of
code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something wrong.

"...add this to the current event procedure" -- are you referring to
--design view of form, then select form, then properties- "on current" ???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on the "on
current" line of the form properities????

thank you

Allen Browne said:
To show a text box only when you are at a new record, add this to the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

i have a text box that displays one date, that is, the next date of the
next
record that needs to be created. i.e. records should be created in
date
order.
so the text box is based on a query that adds 1 to the date of the
record
with the max date.

when a user clicks on the date in the text box, the date field on the
form
is populated and a macro runs which among other things, creates the
record.
the user continues to enter the data into the remaining fields on the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box when
not
on a new record and therefore unknowingly changing the date of an
existing
record or even if he realizes that he made a mistakenly changed the
date
before closing the form or going to a different record he may not
remember
what the original date of the record was.
 
Yes: substitute the name of some other text box that you can safely set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current" line.
can i run the macro and the code you provided?? can i combine them some
way??

thanks for your help



Allen Browne said:
1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties of a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2 lines
of
code.

bettyboopbh said:
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something wrong.

"...add this to the current event procedure" -- are you referring to
--design view of form, then select form, then properties- "on current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add this to the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

i have a text box that displays one date, that is, the next date of
the
next
record that needs to be created. i.e. records should be created in
date
order.
so the text box is based on a query that adds 1 to the date of the
record
with the max date.

when a user clicks on the date in the text box, the date field on
the
form
is populated and a macro runs which among other things, creates the
record.
the user continues to enter the data into the remaining fields on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box
when
not
on a new record and therefore unknowingly changing the date of an
existing
record or even if he realizes that he made a mistakenly changed the
date
before closing the form or going to a different record he may not
remember
what the original date of the record was.
 
Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that makes a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the name of
the list box.
then i tried another field on the form: "delivery1ticket" (which is a text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control' arguments i
used and is as follows:

when the form opened the 'date' field was populated with '12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date populates the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming from.
2 - when the record is created buy clicking the dtae in the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now that it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899' date
replaces the date on
the record. if i press "Esc" the original date on the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



Allen Browne said:
Yes: substitute the name of some other text box that you can safely set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current" line.
can i run the macro and the code you provided?? can i combine them some
way??

thanks for your help



Allen Browne said:
1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties of a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2 lines
of
code.

Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something wrong.

"...add this to the current event procedure" -- are you referring to
--design view of form, then select form, then properties- "on current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add this to the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

i have a text box that displays one date, that is, the next date of
the
next
record that needs to be created. i.e. records should be created in
date
order.
so the text box is based on a query that adds 1 to the date of the
record
with the max date.

when a user clicks on the date in the text box, the date field on
the
form
is populated and a macro runs which among other things, creates the
record.
the user continues to enter the data into the remaining fields on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box
when
not
on a new record and therefore unknowingly changing the date of an
existing
record or even if he realizes that he made a mistakenly changed the
date
before closing the form or going to a different record he may not
remember
what the original date of the record was.
 
Okay, we need to set the Visible property of the list box rather than its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the idea.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the name of
the list box.
then i tried another field on the form: "delivery1ticket" (which is a text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control' arguments
i
used and is as follows:

when the form opened the 'date' field was populated with '12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date populates the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming from.
2 - when the record is created buy clicking the dtae in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now that it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899' date
replaces the date on
the record. if i press "Esc" the original date on the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



Allen Browne said:
Yes: substitute the name of some other text box that you can safely set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

bettyboopbh said:
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current" line.
can i run the macro and the code you provided?? can i combine them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2
lines
of
code.

Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something wrong.

"...add this to the current event procedure" -- are you referring
to
--design view of form, then select form, then properties- "on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add this to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

message
i have a text box that displays one date, that is, the next date
of
the
next
record that needs to be created. i.e. records should be created
in
date
order.
so the text box is based on a query that adds 1 to the date of
the
record
with the max date.

when a user clicks on the date in the text box, the date field on
the
form
is populated and a macro runs which among other things, creates
the
record.
the user continues to enter the data into the remaining fields on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box
when
not
on a new record and therefore unknowingly changing the date of an
existing
record or even if he realizes that he made a mistakenly changed
the
date
before closing the form or going to a different record he may not
remember
what the original date of the record was.
 
Hi Allen

i changed the setvalue expression to :
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

But the results are the sameas before (as stated below).
(it seems that the 'setValue' is causing the '12/29'1899' date.)

thanks



Allen Browne said:
Okay, we need to set the Visible property of the list box rather than its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the idea.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the name of
the list box.
then i tried another field on the form: "delivery1ticket" (which is a text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control' arguments
i
used and is as follows:

when the form opened the 'date' field was populated with '12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date populates the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming from.
2 - when the record is created buy clicking the dtae in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now that it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899' date
replaces the date on
the record. if i press "Esc" the original date on the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



Allen Browne said:
Yes: substitute the name of some other text box that you can safely set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current" line.
can i run the macro and the code you provided?? can i combine them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2
lines
of
code.

Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something wrong.

"...add this to the current event procedure" -- are you referring
to
--design view of form, then select form, then properties- "on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add this to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

message
i have a text box that displays one date, that is, the next date
of
the
next
record that needs to be created. i.e. records should be created
in
date
order.
so the text box is based on a query that adds 1 to the date of
the
record
with the max date.

when a user clicks on the date in the text box, the date field on
the
form
is populated and a macro runs which among other things, creates
the
record.
the user continues to enter the data into the remaining fields on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text box
when
not
on a new record and therefore unknowingly changing the date of an
existing
record or even if he realizes that he made a mistakenly changed
the
date
before closing the form or going to a different record he may not
remember
what the original date of the record was.
 
12/20/1899 is the date value for -1.
True has the value -1.

Therefore it would seem that your macro is still setting the value of the
control instead of the value of its Visible property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

i changed the setvalue expression to :
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

But the results are the sameas before (as stated below).
(it seems that the 'setValue' is causing the '12/29'1899' date.)

thanks



Allen Browne said:
Okay, we need to set the Visible property of the list box rather than its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the idea.

bettyboopbh said:
Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that
makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the name
of
the list box.
then i tried another field on the form: "delivery1ticket" (which is a
text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control'
arguments
i
used and is as follows:

when the form opened the 'date' field was populated with '12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date populates
the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming
from.
2 - when the record is created buy clicking the dtae in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now that
it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899'
date
replaces the date on
the record. if i press "Esc" the original date on
the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



:

Yes: substitute the name of some other text box that you can safely
set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with
actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current"
line.
can i run the macro and the code you provided?? can i combine them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current
property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties
of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2
lines
of
code.

message
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something
wrong.

"...add this to the current event procedure" -- are you
referring
to
--design view of form, then select form, then properties- "on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add this
to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

message
i have a text box that displays one date, that is, the next
date
of
the
next
record that needs to be created. i.e. records should be
created
in
date
order.
so the text box is based on a query that adds 1 to the date of
the
record
with the max date.

when a user clicks on the date in the text box, the date field
on
the
form
is populated and a macro runs which among other things,
creates
the
record.
the user continues to enter the data into the remaining fields
on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text
box
when
not
on a new record and therefore unknowingly changing the date of
an
existing
record or even if he realizes that he made a mistakenly
changed
the
date
before closing the form or going to a different record he may
not
remember
what the original date of the record was.
 
Hi Allen

as i stated, i changed the set value argument expression to:
"[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible" as you suggested,
but it did not make a difference.

"...still setting the value of the
control instead of the value of its Visible property" - ???

how do i fix? i think i entered the macro action(s)/arguments correctly:

for the GoToControl - i tried three (3) differedt fields:
[date] - which is the field that the listbox '[lbd]' populates
[delivery 1 ticket] - wich is just a text field on the form
[lbd] - which is the name of the list box (its control source is 'date')

for the setValue i entered:
item - [lbd] (the name of the listbox)
expression - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].[Visible]

there was no difference regardless of which of the 3 GoToControl argument
(control names) i used.

what else can you suggest??

thanks for your help





Allen Browne said:
12/20/1899 is the date value for -1.
True has the value -1.

Therefore it would seem that your macro is still setting the value of the
control instead of the value of its Visible property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

i changed the setvalue expression to :
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

But the results are the sameas before (as stated below).
(it seems that the 'setValue' is causing the '12/29'1899' date.)

thanks



Allen Browne said:
Okay, we need to set the Visible property of the list box rather than its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the idea.

Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that
makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the name
of
the list box.
then i tried another field on the form: "delivery1ticket" (which is a
text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control'
arguments
i
used and is as follows:

when the form opened the 'date' field was populated with '12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date populates
the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming
from.
2 - when the record is created buy clicking the dtae in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now that
it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899'
date
replaces the date on
the record. if i press "Esc" the original date on
the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



:

Yes: substitute the name of some other text box that you can safely
set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with
actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current"
line.
can i run the macro and the code you provided?? can i combine them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current
property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the properties
of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the 2
lines
of
code.

message
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something
wrong.

"...add this to the current event procedure" -- are you
referring
to
--design view of form, then select form, then properties- "on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add this
to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

message
i have a text box that displays one date, that is, the next
date
of
the
next
record that needs to be created. i.e. records should be
created
in
date
order.
so the text box is based on a query that adds 1 to the date of
the
record
with the max date.

when a user clicks on the date in the text box, the date field
on
the
form
is populated and a macro runs which among other things,
creates
the
record.
the user continues to enter the data into the remaining fields
on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the text
box
when
not
on a new record and therefore unknowingly changing the date of
an
existing
record or even if he realizes that he made a mistakenly
changed
the
date
before closing the form or going to a different record he may
not
remember
what the original date of the record was.
 
Betty, go back to the very first reply I gave you on this thread.

It was 2 lines of code to put into the Current event procedure (code, not
macro.)

Try that.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

as i stated, i changed the set value argument expression to:
"[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible" as you suggested,
but it did not make a difference.

"...still setting the value of the
control instead of the value of its Visible property" - ???

how do i fix? i think i entered the macro action(s)/arguments correctly:

for the GoToControl - i tried three (3) differedt fields:
[date] - which is the field that the listbox '[lbd]' populates
[delivery 1 ticket] - wich is just a text field on the form
[lbd] - which is the name of the list box (its control source is 'date')

for the setValue i entered:
item - [lbd] (the name of the listbox)
expression - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].[Visible]

there was no difference regardless of which of the 3 GoToControl argument
(control names) i used.

what else can you suggest??

thanks for your help





Allen Browne said:
12/20/1899 is the date value for -1.
True has the value -1.

Therefore it would seem that your macro is still setting the value of the
control instead of the value of its Visible property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

i changed the setvalue expression to :
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

But the results are the sameas before (as stated below).
(it seems that the 'setValue' is causing the '12/29'1899' date.)

thanks



:

Okay, we need to set the Visible property of the list box rather than
its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the
idea.

Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that
makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the
name
of
the list box.
then i tried another field on the form: "delivery1ticket" (which is
a
text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control'
arguments
i
used and is as follows:

when the form opened the 'date' field was populated with
'12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date
populates
the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates
the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming
from.
2 - when the record is created buy clicking the dtae
in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now
that
it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899'
date
replaces the date on
the record. if i press "Esc" the original date
on
the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



:

Yes: substitute the name of some other text box that you can safely
set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will
be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

message
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with
actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current"
line.
can i run the macro and the code you provided?? can i combine
them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current
property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the
properties
of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the
2
lines
of
code.

message
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something
wrong.

"...add this to the current event procedure" -- are you
referring
to
--design view of form, then select form, then properties- "on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm
on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add
this
to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

in
message
i have a text box that displays one date, that is, the next
date
of
the
next
record that needs to be created. i.e. records should be
created
in
date
order.
so the text box is based on a query that adds 1 to the date
of
the
record
with the max date.

when a user clicks on the date in the text box, the date
field
on
the
form
is populated and a macro runs which among other things,
creates
the
record.
the user continues to enter the data into the remaining
fields
on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the
text
box
when
not
on a new record and therefore unknowingly changing the date
of
an
existing
record or even if he realizes that he made a mistakenly
changed
the
date
before closing the form or going to a different record he
may
not
remember
what the original date of the record was.
 
the reason you later instructed me to use the 'setValue in the macro as i was
already using the "on current' to run a macro."


Allen Browne said:
Betty, go back to the very first reply I gave you on this thread.

It was 2 lines of code to put into the Current event procedure (code, not
macro.)

Try that.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

as i stated, i changed the set value argument expression to:
"[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible" as you suggested,
but it did not make a difference.

"...still setting the value of the
control instead of the value of its Visible property" - ???

how do i fix? i think i entered the macro action(s)/arguments correctly:

for the GoToControl - i tried three (3) differedt fields:
[date] - which is the field that the listbox '[lbd]' populates
[delivery 1 ticket] - wich is just a text field on the form
[lbd] - which is the name of the list box (its control source is 'date')

for the setValue i entered:
item - [lbd] (the name of the listbox)
expression - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].[Visible]

there was no difference regardless of which of the 3 GoToControl argument
(control names) i used.

what else can you suggest??

thanks for your help





Allen Browne said:
12/20/1899 is the date value for -1.
True has the value -1.

Therefore it would seem that your macro is still setting the value of the
control instead of the value of its Visible property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

i changed the setvalue expression to :
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

But the results are the sameas before (as stated below).
(it seems that the 'setValue' is causing the '12/29'1899' date.)

thanks



:

Okay, we need to set the Visible property of the list box rather than
its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the
idea.

Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that
makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the
name
of
the list box.
then i tried another field on the form: "delivery1ticket" (which is
a
text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control'
arguments
i
used and is as follows:

when the form opened the 'date' field was populated with
'12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date
populates
the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates
the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming
from.
2 - when the record is created buy clicking the dtae
in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now
that
it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899'
date
replaces the date on
the record. if i press "Esc" the original date
on
the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



:

Yes: substitute the name of some other text box that you can safely
set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will
be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

message
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with
actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current"
line.
can i run the macro and the code you provided?? can i combine
them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current
property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the
properties
of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the
2
lines
of
code.

message
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something
wrong.

"...add this to the current event procedure" -- are you
referring
to
--design view of form, then select form, then properties- "on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm
on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add
this
to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

in
message
i have a text box that displays one date, that is, the next
date
of
the
next
record that needs to be created. i.e. records should be
created
in
date
order.
so the text box is based on a query that adds 1 to the date
of
the
record
with the max date.

when a user clicks on the date in the text box, the date
field
on
the
form
is populated and a macro runs which among other things,
creates
the
record.
the user continues to enter the data into the remaining
fields
on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the
text
box
when
 
Hi Allen

i hope you haven't given up on me.

the reason you later instructed me to use [add] the 'setValue in the macro
as i was
already using the "on current' to run a macro."

thank you


Allen Browne said:
Betty, go back to the very first reply I gave you on this thread.

It was 2 lines of code to put into the Current event procedure (code, not
macro.)

Try that.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

as i stated, i changed the set value argument expression to:
"[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible" as you suggested,
but it did not make a difference.

"...still setting the value of the
control instead of the value of its Visible property" - ???

how do i fix? i think i entered the macro action(s)/arguments correctly:

for the GoToControl - i tried three (3) differedt fields:
[date] - which is the field that the listbox '[lbd]' populates
[delivery 1 ticket] - wich is just a text field on the form
[lbd] - which is the name of the list box (its control source is 'date')

for the setValue i entered:
item - [lbd] (the name of the listbox)
expression - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].[Visible]

there was no difference regardless of which of the 3 GoToControl argument
(control names) i used.

what else can you suggest??

thanks for your help





Allen Browne said:
12/20/1899 is the date value for -1.
True has the value -1.

Therefore it would seem that your macro is still setting the value of the
control instead of the value of its Visible property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

i changed the setvalue expression to :
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

But the results are the sameas before (as stated below).
(it seems that the 'setValue' is causing the '12/29'1899' date.)

thanks



:

Okay, we need to set the Visible property of the list box rather than
its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the
idea.

Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if that
makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to your
instructions.
for the go to control i tried two arguments. 1st i used "lbd" the
name
of
the list box.
then i tried another field on the form: "delivery1ticket" (which is
a
text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control'
arguments
i
used and is as follows:

when the form opened the 'date' field was populated with
'12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date
populates
the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an creates
the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is comming
from.
2 - when the record is created buy clicking the dtae
in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now
that
it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the '12/29/1899'
date
replaces the date on
the record. if i press "Esc" the original date
on
the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox become
invisable.

thank for your help



:

Yes: substitute the name of some other text box that you can safely
set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue will
be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

message
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted with
actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on current"
line.
can i run the macro and the code you provided?? can i combine
them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current
property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the
properties
of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter the
2
lines
of
code.

message
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing something
wrong.

"...add this to the current event procedure" -- are you
referring
to
--design view of form, then select form, then properties- "on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when i'm
on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add
this
to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

in
message
i have a text box that displays one date, that is, the next
date
of
the
next
record that needs to be created. i.e. records should be
created
in
date
order.
so the text box is based on a query that adds 1 to the date
of
the
record
with the max date.

when a user clicks on the date in the text box, the date
field
on
the
form
is populated and a macro runs which among other things,
creates
the
record.
the user continues to enter the data into the remaining
fields
on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the
text
box
when
 
Betty, it is possible to RunMacro from code.

It is also possible to RunCode in a macro.

Or you could convert one into the other so you have only one to deal with.

I may need to let you figure out how to do that.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

bettyboopbh said:
Hi Allen

i hope you haven't given up on me.

the reason you later instructed me to use [add] the 'setValue in the macro
as i was
already using the "on current' to run a macro."

thank you


Allen Browne said:
Betty, go back to the very first reply I gave you on this thread.

It was 2 lines of code to put into the Current event procedure (code, not
macro.)

Try that.

bettyboopbh said:
Hi Allen

as i stated, i changed the set value argument expression to:
"[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible" as you suggested,
but it did not make a difference.

"...still setting the value of the
control instead of the value of its Visible property" - ???

how do i fix? i think i entered the macro action(s)/arguments
correctly:

for the GoToControl - i tried three (3) differedt fields:
[date] - which is the field that the listbox '[lbd]' populates
[delivery 1 ticket] - wich is just a text field on the form
[lbd] - which is the name of the list box (its control source is
'date')

for the setValue i entered:
item - [lbd] (the name of the listbox)
expression - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].[Visible]

there was no difference regardless of which of the 3 GoToControl
argument
(control names) i used.

what else can you suggest??

thanks for your help





:

12/20/1899 is the date value for -1.
True has the value -1.

Therefore it would seem that your macro is still setting the value of
the
control instead of the value of its Visible property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

i changed the setvalue expression to :
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

But the results are the sameas before (as stated below).
(it seems that the 'setValue' is causing the '12/29'1899' date.)

thanks



:

Okay, we need to set the Visible property of the list box rather
than
its
Value.

Try setting the value of:
[Forms]![DAILY FUEL ACTIVITY 2 FORM].[lbd].Visible

Not sure if I have the names matching your list box, but that's the
idea.

message
Hi Allen

how are you?? (fine i hope)

i stated textbox; i should have stated listbox (i'm not sure if
that
makes
a
difference in how to hide it.)

here's what i did in trying to follow your instructions:

i created a new macro so i could isolate the results i got to
your
instructions.
for the go to control i tried two arguments. 1st i used "lbd"
the
name
of
the list box.
then i tried another field on the form: "delivery1ticket" (which
is
a
text
field).

for the set value i used,
'item' - [lbd],
'expression' - [Forms]![DAILY FUEL ACTIVITY 2 FORM].[newrecord]

the results i got were the same for both of the 'go to control'
arguments
i
used and is as follows:

when the form opened the 'date' field was populated with
'12/29/1899'
(prior, the form
would open and the dtae field would be blank)
if i ignor that date an click the listbox, the list box date
populates
the
'date' field (replacing 12/29/1899).
a macro runs (set to run on click on the listbox [lbd] ) an
creates
the
record and subforms display data.

problems 1 - 12/29/1899 - i don't know where this date is
comming
from.
2 - when the record is created buy clicking the
dtae
in
the
list box, which
runs the macro, the listbox stays visable.
i need it to be invisable at this point (now
that
it
IS a record (usually
my last (max date record).
3 - if i go back to revious records, the
'12/29/1899'
date
replaces the date on
the record. if i press "Esc" the original
date
on
the
records returns.
4 - at no point, 1 , 2 , or 3 does the listbox
become
invisable.

thank for your help



:

Yes: substitute the name of some other text box that you can
safely
set
focus to.

You can put these 2 lines in your macro.
Use the GotoControl action instead of the SetFocus line.
Use SetValue instead of the 2nd line.
The 2 arguments (lower pane of macro design) for the SetValue
will
be:
a) the name of the text box you wish to hide;
b) [Forms].[PutYourFormNameHere].[NewRecord]

message
Hi Allen

i got the following error: run-time error '2465':
microsoft access can't fine the field '|' referred to in your
expression.

here' what i actually used:
Me.[SomeOtherTextBox].SetFocus
Me.[textboxdate].Visible = Me.NewRecord (i substituted
with
actual
name)
(do you want me to substitute for "[someothertextbox] ???

also, one other thing. i was running a macro on the "on
current"
line.
can i run the macro and the code you provided?? can i
combine
them
some
way??

thanks for your help



:

1. Open the form in design view.

2. Open the Properties box (View menu.)

3. On the Event tab of the Properties box, set the On Current
property
to:
[Event Procedure]
(If you don't see On Current, you may be looking at the
properties
of
a
text
box instead of the form.)

4. Click the Build button (...) beside the property.
Access opens the code window.

5. Between the "Private Sub ..." and "End Sub" lines, enter
the
2
lines
of
code.

in
message
Hi Allen

thanks for trying to help.

i'm a newbie, so could you be a little more step by step.
i did give your code a try but i'm obviously doing
something
wrong.

"...add this to the current event procedure" -- are you
referring
to
--design view of form, then select form, then properties-
"on
current"
???

for "[someothertextbox]" what am i to substitute???

and where do i enter the code. do i use code builder when
i'm
on
the
"on
current" line of the form properities????

thank you

:

To show a text box only when you are at a new record, add
this
to
the
Current event procedure of the form:
Me.[SomeOtherTextBox].SetFocus
Me.[NameOfYourTextBoxHere].Visible = Me.NewRecord

"bettyboopbh" <[email protected]>
wrote
in
message
i have a text box that displays one date, that is, the
next
date
of
the
next
record that needs to be created. i.e. records should be
created
in
date
order.
so the text box is based on a query that adds 1 to the
date
of
the
record
with the max date.

when a user clicks on the date in the text box, the date
field
on
the
form
is populated and a macro runs which among other things,
creates
the
record.
the user continues to enter the data into the remaining
fields
on
the
form.
so far so good.

the problem i'm trying to prevent is a user clicking the
text
box
when
 
Back
Top