runtime error 2489

R

Revned

hi,

i have a form bound with a query
and my query has this SQL

SELECT tblItem.ItemCode, tblItem.CategoryID, tblItem.ItemDescription,
tblItem.Price, tblItem.Taxrate, tblDrinkingWaterType.TypeCode,
tblDrinkingWaterType.TypeName
FROM tblDrinkingWaterType INNER JOIN tblItem ON
tblDrinkingWaterType.TypeName = tblItem.TypeName;

i have a cmdNewItem button, i want that when i click from this button it
allows me to add new items to this "NewItem" form

i have also set Data Entry, Allow Edits, Allow Additions to Yes
i do attempt to write this code to cmdNewItem button but i have this error
i am using access 2003

DoCmd.GoToRecord , "New Item", acNewRec

Run Time Error 2489'
The object "NewItem'isn't open

thanks for any help i appreciate
 
D

Douglas J. Steele

The syntax for GoToRecord is

DoCmd.GoToRecord [objecttype, objectname][, record][, offset]

Since you're leaving out the first parameter (objecttype), it defaults to
acActiveDataObject (which in your case would be the form on which
cmdNewButton exists). But your second parameter (objectname) is set to "New
Item", so Access will assume that it's a form.

If you're trying to move to a new record on the form on which cmdNewButton
exists, leave out the "New Item" parameter:

DoCmd.GoToRecord , , acNewRec

If you're trying to go to a new record on another form, you need to ensure
that the other form is open: GoToRecord will not open it for you.
 
R

Revned

i have this code now in my NewItemd button
but is gives me
Run-time Error '2105'
You can't go to the specified record
Private Sub NewItem_Click()
DoCmd.GoToRecord acDataForm, "NewItem", acNewRec
End Sub

one more thing this button resides on the "NewItem" form
what else do i miss here

thanks again

Douglas J. Steele said:
The syntax for GoToRecord is

DoCmd.GoToRecord [objecttype, objectname][, record][, offset]

Since you're leaving out the first parameter (objecttype), it defaults to
acActiveDataObject (which in your case would be the form on which
cmdNewButton exists). But your second parameter (objectname) is set to "New
Item", so Access will assume that it's a form.

If you're trying to move to a new record on the form on which cmdNewButton
exists, leave out the "New Item" parameter:

DoCmd.GoToRecord , , acNewRec

If you're trying to go to a new record on another form, you need to ensure
that the other form is open: GoToRecord will not open it for you.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Revned said:
hi,

i have a form bound with a query
and my query has this SQL

SELECT tblItem.ItemCode, tblItem.CategoryID, tblItem.ItemDescription,
tblItem.Price, tblItem.Taxrate, tblDrinkingWaterType.TypeCode,
tblDrinkingWaterType.TypeName
FROM tblDrinkingWaterType INNER JOIN tblItem ON
tblDrinkingWaterType.TypeName = tblItem.TypeName;

i have a cmdNewItem button, i want that when i click from this button it
allows me to add new items to this "NewItem" form

i have also set Data Entry, Allow Edits, Allow Additions to Yes
i do attempt to write this code to cmdNewItem button but i have this error
i am using access 2003

DoCmd.GoToRecord , "New Item", acNewRec

Run Time Error 2489'
The object "NewItem'isn't open

thanks for any help i appreciate
 
D

Douglas J. Steele

If the button's on the form where you want to work with the new record, did
you try

DoCmd.GoToRecord , , acNewRec

as I suggested?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Revned said:
i have this code now in my NewItemd button
but is gives me
Run-time Error '2105'
You can't go to the specified record
Private Sub NewItem_Click()
DoCmd.GoToRecord acDataForm, "NewItem", acNewRec
End Sub

one more thing this button resides on the "NewItem" form
what else do i miss here

thanks again

Douglas J. Steele said:
The syntax for GoToRecord is

DoCmd.GoToRecord [objecttype, objectname][, record][, offset]

Since you're leaving out the first parameter (objecttype), it defaults to
acActiveDataObject (which in your case would be the form on which
cmdNewButton exists). But your second parameter (objectname) is set to
"New
Item", so Access will assume that it's a form.

If you're trying to move to a new record on the form on which
cmdNewButton
exists, leave out the "New Item" parameter:

DoCmd.GoToRecord , , acNewRec

If you're trying to go to a new record on another form, you need to
ensure
that the other form is open: GoToRecord will not open it for you.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Revned said:
hi,

i have a form bound with a query
and my query has this SQL

SELECT tblItem.ItemCode, tblItem.CategoryID, tblItem.ItemDescription,
tblItem.Price, tblItem.Taxrate, tblDrinkingWaterType.TypeCode,
tblDrinkingWaterType.TypeName
FROM tblDrinkingWaterType INNER JOIN tblItem ON
tblDrinkingWaterType.TypeName = tblItem.TypeName;

i have a cmdNewItem button, i want that when i click from this button
it
allows me to add new items to this "NewItem" form

i have also set Data Entry, Allow Edits, Allow Additions to Yes
i do attempt to write this code to cmdNewItem button but i have this
error
i am using access 2003

DoCmd.GoToRecord , "New Item", acNewRec

Run Time Error 2489'
The object "NewItem'isn't open

thanks for any help i appreciate
 
R

Revned

yes it works will right now

thank you very much Douglas Steele
and i also reconstruct my SQL

thank you Douglas Steele

Douglas J. Steele said:
If the button's on the form where you want to work with the new record, did
you try

DoCmd.GoToRecord , , acNewRec

as I suggested?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Revned said:
i have this code now in my NewItemd button
but is gives me
Run-time Error '2105'
You can't go to the specified record
this my code now<<<<<<
Private Sub NewItem_Click()
DoCmd.GoToRecord acDataForm, "NewItem", acNewRec
End Sub

one more thing this button resides on the "NewItem" form
what else do i miss here

thanks again

Douglas J. Steele said:
The syntax for GoToRecord is

DoCmd.GoToRecord [objecttype, objectname][, record][, offset]

Since you're leaving out the first parameter (objecttype), it defaults to
acActiveDataObject (which in your case would be the form on which
cmdNewButton exists). But your second parameter (objectname) is set to
"New
Item", so Access will assume that it's a form.

If you're trying to move to a new record on the form on which
cmdNewButton
exists, leave out the "New Item" parameter:

DoCmd.GoToRecord , , acNewRec

If you're trying to go to a new record on another form, you need to
ensure
that the other form is open: GoToRecord will not open it for you.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hi,

i have a form bound with a query
and my query has this SQL

SELECT tblItem.ItemCode, tblItem.CategoryID, tblItem.ItemDescription,
tblItem.Price, tblItem.Taxrate, tblDrinkingWaterType.TypeCode,
tblDrinkingWaterType.TypeName
FROM tblDrinkingWaterType INNER JOIN tblItem ON
tblDrinkingWaterType.TypeName = tblItem.TypeName;

i have a cmdNewItem button, i want that when i click from this button
it
allows me to add new items to this "NewItem" form

i have also set Data Entry, Allow Edits, Allow Additions to Yes
i do attempt to write this code to cmdNewItem button but i have this
error
i am using access 2003

DoCmd.GoToRecord , "New Item", acNewRec

Run Time Error 2489'
The object "NewItem'isn't open

thanks for any help i appreciate
 

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