Date format / runtime

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

Guest

I need to format a date as yyyymmdd in VBA. The code below works for the
full version of Access but generates an error for the runtime version:

Dim DateTemp
DateTemp = Format(Date, "yyyymmdd")

This error occurs even if I insert a MsgBox on the line before the above
code. That is, it occurs when I open the form before it gets to my MsgBox. Is
my runtime missing a reference that is needed to evaluate the Format method?
 
May be a missing reference when you prepared the runtime version. Try
creating the runtime again, but check the references to be sure all are ok
first.

--

Ken Snell
<MS ACCESS MVP>

Brian said:
I need to format a date as yyyymmdd in VBA. The code below works for the
full version of Access but generates an error for the runtime version:

Dim DateTemp
DateTemp = Format(Date, "yyyymmdd")

This error occurs even if I insert a MsgBox on the line before the above
code. That is, it occurs when I open the form before it gets to my MsgBox. Is
my runtime missing a reference that is needed to evaluate the Format
method?
 
This app is a routine to manage DB2 backup folders by deleting old backup
folders, and it runs on a Win2K SBS but on a Win2003 SBS (both installed
using the same runtime package). I have narrowed it down to the Format
statement. Is it even a reference issue? There are some newer versions of a
couple of the reference files on the 2003 SBS, but I am loath to replace them
with older versions in case there is something else on the 2003 SBS that
needs the newer version.
 
Let's start with what the error is. What does the error message state? That
may help us figure out what is going on.
--

Ken Snell
<MS ACCESS MVP>
 
Hmmm...well I thought I had this pinned on the Format, because every time I
commented it out, things ran fine. In the meantime, however, I did a cleanup
- created a new DB and imported the objects to recreate this one,thus getting
rid of a host of bogus prior entries in MSysQueries (left over from various
DB's I have gone through, copying one to the next to preserve startup
settings & code, etc).

The result was that the problem quit happening. However, it did bring up the
question of whether there is a more efficient way to clean out all those
obsolete entries in MSybObjects than creating a new DB and importing. The
problem with that approach is that I must also re-append my AllowBypassKey
property, re-created my custom menu bar(s), and reset all my startup options.
Any ideas on this?
 
You can import toolbars from one database to another, just as you can import
the objects (tables, etc.). On the wizard window that lets you select the
objects, there is a button named Options in lower right corner; click that
and you'll see more options for importing things.

When you say append your AllowBypassKey property, are you referring to the
VBA code in a regular module? Modules also can be imported.
--

Ken Snell
<MS ACCESS MVP>
 
I imported the module, but I still had to append the AllowBypassKey property
manually. I ran this code once to prepare the DB to allow me to turn the
bypass key on/off as needed (I do this to hide my code instead of compiling
to an .mde.)

Dim abc As Object
Set abc = CurrentDb.CreateProperty("AllowBypassKey", DB_BOOLEAN, True)
CurrentDb.Properties.Append abc

In addition, I make extensive use of relationships. Are these importable as
well? Also, I have to reset all the startup options.

Often when creating new DB's, I open an existing DB that has all the right
startup options and and modify existing forms instead of having to start from
scratch. However, when I delete the queries, it leaves them in MSysQueries.
Eventually (as I just discovered) I end up with a 1500k DB that, when
imported to a new DB, became 140k. In this case, it also resolved the error
in question

The bottom line is whether there is a way to clear out all the obsolete
entries in MSysQueries MSysObjects.
 
Other than manually deleting them, I am not aware of a method. But I have
not had to work with these "extra" queries before, so I've never
investigated them -- thus, maybe someone else knows of a way.

Relationships can be imported along with the tables; again, it's in the
Options list that I mentioned.
 
Yes, I did find the relationships under options as you said. Thanks.

One thing is still not clear to me. Is it an intential design function for
Access to retain queries in MSysQueries even after the query is deleted? The
ones in question are references to queries that I have previously deleted or
queries related to forms that have deleted. I cannot find any way to delete
from MSysQueries - I get access denied errors whether I try to do it manually
or by running a delete query against that table. I would have expected these
to go away on a compact/repair, but no such luck. I wouldn't care, but it
caused a significant amount of bloat.
 
I do not have any additional knowledge about the MSysQueries and can't
provide more info about your question... sorry!
 
Back
Top