Getting a form to "forget" a field name?

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

Guest

I unwisely linked a form to a table that had a field named "date" in it. The
form has date filters on it, so I often have to reset the filter to "today",
and normally use Date to do this.

I notice that this confused the form, which thought I was referring to the
field instead of the function. I couldn't figure out how to fix this, so I
renamed the field in the table (which was temp data). However, the form still
seems to remember that I _used_ to have a field called "date" and now it
gives me errors saying the field is missing when I try to call the function.

Any advice?

Maury
 
Access has a "feature" called Name AutoCorrect that *tries* to remember what
things used to be called and still recognise them by that name in some
contexts. This causes no end of problems. If you want some examples, see:
http://allenbrowne.com/bug-03.html

To solve the issue, try this sequence:

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect

2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact/Repair

3. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

4. Open Access (holding down the Shift key if you have any startup code),
and compact again.

5. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

At this point, you should have a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, reference ambiguities are resolved,
and the code syntax is compilable.

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

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

message
news:[email protected]...
 
Even though you changed the field name in the table, you need to make sure
your not still referring to the old name in the form. Check the properties
of the control in the form and make sure the control source is not still
referring to [Date]. Also, if you were sorting or grouping within the form
on the [date] field, it will give an error message looking for the [date]
field. Double check this on the form.

In the future, if you mistakenly use a reserved Access word for a field,
make sure you refer to it in brackets [fieldname] on the form or in queries,
code , etc..

Jim B.
 
Well no luck so far, but thanks for the attempts!

Allen - I tried most of the steps in your guide with no luck. However the
"main" one I can't do -- I can't find the menu item to turn it off. I looked
all through the options I could find and there's nothing except for the
spelling autocorrect. I'm running 2003 SP1, there's no option for it that I
can find.

Jim - I looked everywhere but I don't see any remaining references. I even
changed the record source to SELECT * FROM vFundAccounting WHERE 1=0 in order
to clear out any sorting or data. I recall that there are often settings on
the form that you can't see in Properties, but I don't see any in this case.

Crazy!

Maury
 
Well I "solved" it. I simply copied the form into a new one, "theform2", and
it worked fine. I delete the original, renamed and presto.

Wild!

Maury
 
Maury

On Access's main menu, click on Tools>Options. Under the General tab, you
should see Name AutoCorrect. Uncheck the first box in that group.
 
Very pleased you solved it.

I suggest you still ensure you get Name AutoCorrect turned off. I've counted
more than a dozen bugs it caused, and don't bother counting any more. If you
don't this kind of problem may return.

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

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

message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top