New record halt error

G

Guest

Hello I have a macro go to record/new on my form and its not working on some
of the computers at work it keeps giving me

Macro Name: mcr_NewRecord
Condition: True
Action name: GoToRecord
Arguments: -1,,New,

How do I fix this? Its driving me crazy
 
6

'69 Camaro

Hi.
How do I fix this? Its driving me crazy

Convert the macro to a VBA procedure. Error handling will automatically be
added, unless you remove the default when converting. Compile the code,
then rename the macro to something else, then repeat the steps that brought
about the calling of that macro. An error message will display, telling you
what is wrong. Once you fix what's wrong, delete the macro, because the new
VBA procedure will always be called instead. If you don't understand what
the error message is telling you or how to fix it, please post back with the
error message.

Macros lack error handling capabilities, so if you rely on macros, you're
going to be in the dark most of the time when things go wrong, not to
mention when run-time errors occur, they can crash Access.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Im so sorry but I have no clue what your saying? Here is the message:

Macro Name: mcr_NewRecord
Condition: True
Action name: GoToRecord
Arguments: -1,,New,

Thats all I want is when I open the Form I wanted it to go to a blank
record. So I created a macro called mcr_NewRecord and put it in the Forms On
Open Event. Thats all the Macro is Action= GoToRecord and in the Arguments
section I put in New under "Record" It works on my PC and my PC at home but
when other users at work try it I get the error mentioned above. Please
help!!! Thanks.
 
6

'69 Camaro

Hi.
Im so sorry but I have no clue what your saying?

Then you should be posting your questions in the "Getting Started" newsgroup
or "New Users" discussion forum, because it's assumed you're not a new user
and know your way around Access when you post in any of the other Access
newsgroups. The "Getting Started" newsgroup or "New Users" discussion forum
assumes all questioners are new users, so explanations are given
step-by-step because the questioner doesn't know his way around Access yet.
Our answers in the other newsgroups won't be step-by-step instructions that
you need to help you achieve what you want to do, because the other
newsgroups don't expect beginners unless explicitly informed of this fact in
the questioner's post. However, now that I know you're a new user, I'd be
happy to provide the step-by-step instructions.

Select the name of the macro in the Database Window. Select the Tools ->
Macro -> Convert Macros to Visual Basic menu, then press the "Convert"
button, and press the "OK" button when it's done. Select the Debug ->
Compile <DatabaseName> menu in the VB Editor to compile the code. Press
<ALT><F11> to return to the Access Window. Rename the macro to something
else, such as mcr_NewRecord_DeleteThis. Open your form in Design View and
go to the Form OnOpen event. Change:

mcr_NewRecord

To:

=mcr_NewRecord()

Open your form in Form View, whereupon the new VBA procedure will be used
instead of the macro. The error message should tell you why it can't move
to the new record when opening the form. If you don't understand the
message, or don't know how to fix it, please post the error message in your
next post, and we'll try to help you troubleshoot it.
Here is the message:

Macro Name: mcr_NewRecord
Condition: True
Action name: GoToRecord
Arguments: -1,,New,

That's equivalent to asking the mechanic to check the radiator fluid,
whereupon he unscrews the cap, pronounces "Yup. It's green," and replaces
the cap. ;-) That message tells you the current settings for your macro.
It doesn't tell you diddly squat about _why_ Access can't go to a new
record. That's why one should _never_ use macros, except for the AutoKeys
macro. All other macros have VBA procedure equivalents and have the
opportunity to include error handling and pause the code, which macros do
not. Now that you know exactly how to convert all the rest of your macros
to VBA code, I recommend you do so as soon as possible.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Ok, Im sory for misleading you about being a newbie! I did what you said and
it createda module. I renamed the module mcrNewRecord and I had also renamed
the Macro mcrNewRecord. I went into the forms Event On Open and typed in
=mcrNewRecord() and then ren the database. Now the error I get is "The
Microsoft Jet Database engine could not find the object". Make sure the
object exists and that you spell its name and the path name correctly."
 
6

'69 Camaro

Hi.
I renamed the module mcrNewRecord and I had also renamed
the Macro mcrNewRecord.

Don't do that. The macro should be deleted or identified as "to be
deleted," not renamed so that you have two objects in the database with the
same name. I suggest renaming the module so that no one confuses the name
with that of a macro. I suggest modNewRecord or basNewRecord, but ensure
that the name of any module in your database is not the same as any VBA
procedure, or you'll have problems.
I went into the forms Event On Open and typed in
=mcrNewRecord() and then ren the database. Now the error I get is "The
Microsoft Jet Database engine could not find the object".

There is no public function named mcrNewRecord. The Wizard created a VBA
procedure with the same name as your macro -- before you changed it. If you
check, I believe you'll find the VBA procedure is named mcr_NewRecord. Make
sure that the event procedure is calling the VBA procedure's name, not the
macro's or module's name, because I have a feeling you're going to have
another round of name changing. Just make sure your Track Name AutoCorrect
option is off before you change the names. It's commonly nicknamed "Track
Name AutoCorrupt," due to the problem it causes.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Im sorry I misread your posting. It made a module named Converted Macro-
mcr_NewRecord and I renamed my Origional Macro mcr_NewRecord_DeleteThis. I
then ran the database and got this error. "You Cant go to the specified
record" Sorry about that I thought you wanted me to get rid of the _ In my
macro name. Thanks!
 
6

'69 Camaro

Hi.
I
then ran the database and got this error. "You Cant go to the specified
record"

Perhaps your form is bound to a non-updateable query. Or perhaps the form's
Add Additions Property is set to No. Or perhaps the form isn't bound to a
data source.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

well the allow aditions is set to yes, I dont know what you mean about bound
to data source or non-updateable query. I am not running a query for this
form and all data is being stored in a table.
 
G

Guest

I just dont get it!! I have a few databases here at work and they all have
the macro new record and this is the first one that is giving me trouble! I
just cant understand why it works on one PC and not the other? Please
explain... Thanks!
 
6

'69 Camaro

Hi.
I am not running a query for this
form and all data is being stored in a table.

That gives you zero flexibility. One should always create a query based
upon a table or tables, and then use that query as the Record Source
Property (i.e., data source) for the form. That's what it means to have a
"bound" form. An unbound form has no data source, i.e., query or table as
its Record Source Property.

Please tell me about the table. Is it a linked table through a DSN (Data
Source Name)? Does it have the "read-only" option marked in the DSN's
options? If it's not a linked table, is User-Level Security applied to this
Jet table?

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
6

'69 Camaro

Hi.
I
just cant understand why it works on one PC and not the other? Please
explain... Thanks!

Something isn't the same on the database or PC where it doesn't work when
compared to the other databases or PC's. I asked you some questions in my
other post so that we can narrow down what's wrong. Please take a look at
those questions and post back the answers.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

I went to one of the other PC's and its running Access 2003 so I gave it a
try and converted the database to 2003 and now it works on that PC when it
didnt before? What do you mean is it set to read only? Where is this because
when I open it on other PC's it says "Read Only" also I never set a user
level security. Yes the form is llnked to the table threw the source in the
forms properties. I hope I answered all the questions you needed.. Im not
sure if it works on other PC's because I dont have a chance to check till
tomorrow when everyone gets here. Thanks!
 
6

'69 Camaro

Hi.
I went to one of the other PC's and its running Access 2003 so I gave it a
try and converted the database to 2003 and now it works on that PC when it
didnt before?

The file you converted to Access 2003 is a different file.
What do you mean is it set to read only?

I was asking about the DSN's read-only option, but a DSN is used when
linking tables to an ODBC database, and it isn't necessarily required.
Where is this because
when I open it on other PC's it says "Read Only"

This makes me suspect that you copied your database at home onto a CD, then
installed the database from CD onto a Windows 2000 (or earlier) workstation,
without changing the file's read-only attribute. Windows XP will change the
file's read-only attribute automatically, but earlier versions of Windows
don't. If the file is read-only, then you won't be able to add a new record
to the table, hence the error when you try with your VBA procedure.
Yes the form is llnked to the table

No. The form is bound to the table. A database file links to tables in
another file. Only tables can be linked, never forms or reports. (I know
that goes against the usual definition of "link," but that's database
terminology.)
Im not
sure if it works on other PC's because I dont have a chance to check till
tomorrow when everyone gets here.

Open Windows Explorer and navigate to the database file you saved to the
hard drive after you brought it from home. Right-click on the file name and
select "Properties" from the pop-up menu. Look towards the bottom left and
ensure that the read-only check box is unchecked. If it's checked, that's
your problem.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Im not at work right now but I will check it as soon as I get there today! I
made the database on my home PC in 2000 and put it on my USB Pen and
installed it from there not a CD. One question though? Why would this make
that macro not work? I will let you know if that fixed the problem! Thanks
 
6

'69 Camaro

Hi.
Why would this make
that macro not work?

If the file is read-only, changes to the file are forbidden. Adding a new
record is a change to the file. Hence, "You cant go to the specified
record," because the record cursor can't move to a position that doesn't
exist.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

It must have fixed the read only or whatever when I converted it. Now
everyones PC can open it. Thanks for the help!!!!
 

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

Top