The "date" and the "visible" functions don't work

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

Guest

I have two problems that are probably related. I have just gotten my own
Access DB software. When I try and use the Date() function (or just Date) in
VB code, I get an error message. The same thing happens when I use "visible"
when creating a input parameter popup form and I enter the word "visible" in
the SetValue action Item (it's not in the drop down list but it should be).
 
Welcome to the world of Access. :-)

If this is a new setup, I'm guessing you have a missing reference.
From the code window, choose References on the Tools menu.
Look for any checked box with "MISSING" beside it.
More on references:
http://allenbrowne.com/ser-38.html

There are some contexts where Visible does not show in the enumerated list
while you code. Can't tell if that applies to you without more details.

When you get an error message, it helps us identify the issue if you include
the error number/message in your post.
 
Thank you for your response. Unfortuanetly I did not find the word MISSING
when I looked at the References.

Here is my code for date. You can see it is very simple.

Private Sub DateLastUpdated_DblClick(Cancel As Integer)

Dim DateLastUpdated As String
DateLastUpdated = Date

End Sub

I am not getting a message now for the Date problem, but when I double click
on the field, nothing happens.

Regarding the "visible" problem, I get the following message (no number)

You entered an expression that has an invalid reference to the property
Visible.
The property may not exist or may not apply to the object you specified.

It is like neither of these functions exists - I've used them before in
Access 97, but my version of 2003 can't seem to find them. I know you can
use visible when creating a popup to select report criteria.

Do you have any more ideas?

thanks,
Etta M.
 
Is DateLastUpdated the name of a text box on your form?

If so, you don't need the first one in your procedure. You declared a string
with the same name as your control. You set the string to hold the date (as
text), but that did not affect your control. Then the procedure ends, and so
the string goes out of scope, and nothing except the (now extinct) string
was changed. In the same way, string variables do not have a Visible
property.

So, just drop the first line. You can explicitly set the control on your
form with just the line:
Me.DateLastUpdated = Date

BTW, if you want Access to set this field to the current date whenever the
record is changed, you could put that line into Form_BeforeUpdate.
 
Well, is my face red. I should have figured that out. Thank you so much for
your help. I did some programming in Access years ago, and I'm just starting
it again. Guess I'm a little rusty.

Any ideas on the visible problem in the Macro?
The Macro has name OK and the Action Set Value. I tried to set the Item to
[visible] and the Expression to be No.
But I get the message that reads as follows:
You entered an expression that has an invalid reference to the property
Visible.
The property may not exist or may not apply to the object you specified.
Visible is not a choice in the drop down box.

Then I get an Action Failed Box with the same information.
Macro Name: TaskSelectionMacro.OK (I named it TaskSelectionMacro)
Condition: True
Action Name: SetValue
Arguments: [Visible}, No
I was following the instructions in Help under "Create a form to enter
report criteria". I've done it before and have not had a problem.
I hope this not another stupid mistake. I don't mean to waste your time.
Thanks again for your help.

Etta M
 
Try using a full reference to the item you are trying to set, e.g.:
[Forms].[Form1].[Text0].[Visible]
 
Back
Top