List Items Edit Form want to open to blank entry

J

j_gold

Hi, I have a combo box control which allows edits to the list items by
specifying a List Items Edit Form.

When I go to add an entry through the "edit" button that
appears when I click on the combobox it goes to the first record of the form
used to edit. I want users to be taken to a blank form and not see any other
records. Is this possible?

Thanks,

J Gold
 
S

S.Clark

Either:
1. Set the Form's [Data Entry] property to Yes.
2. Enter this code into the OnOpen Event of the Form

DoCmd.GotoRecord acNewRec
 
J

j_gold

Sorry, should have clarified. The form that the combo box uses is also used
separately so that the user can scroll through and make changes to the
entries. If I set the forms data entry property to yes I cannot view all
records. If I use the OnOpen Event then I am always taken to a new record.

What I want is to have it go to a new record only if the combobox has called
the form.

J


S.Clark said:
Either:
1. Set the Form's [Data Entry] property to Yes.
2. Enter this code into the OnOpen Event of the Form

DoCmd.GotoRecord acNewRec

j_gold said:
Hi, I have a combo box control which allows edits to the list items by
specifying a List Items Edit Form.

When I go to add an entry through the "edit" button that
appears when I click on the combobox it goes to the first record of the form
used to edit. I want users to be taken to a blank form and not see any other
records. Is this possible?

Thanks,

J Gold
 
S

S.Clark

I don't understand how the combo calls the form, but...

the DoCmd.openForm method has an OpenArgs parameter. You could pass a
value, and in the form's OnOpen, look to see what the value is, and react to
it.

If me.openargs = "The combobox called me so go to a new rec" then
docmd.gotorecord acnewrec
end if

Maybe pick a shorter value than that, though. :D

j_gold said:
Sorry, should have clarified. The form that the combo box uses is also used
separately so that the user can scroll through and make changes to the
entries. If I set the forms data entry property to yes I cannot view all
records. If I use the OnOpen Event then I am always taken to a new record.

What I want is to have it go to a new record only if the combobox has called
the form.

J


S.Clark said:
Either:
1. Set the Form's [Data Entry] property to Yes.
2. Enter this code into the OnOpen Event of the Form

DoCmd.GotoRecord acNewRec

j_gold said:
Hi, I have a combo box control which allows edits to the list items by
specifying a List Items Edit Form.

When I go to add an entry through the "edit" button that
appears when I click on the combobox it goes to the first record of the form
used to edit. I want users to be taken to a blank form and not see any other
records. Is this possible?

Thanks,

J Gold
 
F

Frank H

The list items edit form should be used only for that purpose.
Why not just make a separate form, just to add new records. Or you can copy
the form you are using, name it differently, and reuse it. Then you can use
it's property sheet in design view to make it an add only form; if I recall,
the property name is DataEntry only, or something like that.
This way you won't need any VBA. (I think! I haven't tried this yet in 2007.)
--
Frank H
Rockford, IL


j_gold said:
Sorry, should have clarified. The form that the combo box uses is also used
separately so that the user can scroll through and make changes to the
entries. If I set the forms data entry property to yes I cannot view all
records. If I use the OnOpen Event then I am always taken to a new record.

What I want is to have it go to a new record only if the combobox has called
the form.

J


S.Clark said:
Either:
1. Set the Form's [Data Entry] property to Yes.
2. Enter this code into the OnOpen Event of the Form

DoCmd.GotoRecord acNewRec

j_gold said:
Hi, I have a combo box control which allows edits to the list items by
specifying a List Items Edit Form.

When I go to add an entry through the "edit" button that
appears when I click on the combobox it goes to the first record of the form
used to edit. I want users to be taken to a blank form and not see any other
records. Is this possible?

Thanks,

J Gold
 
J

j_gold

Thanks, got it working.

Private Sub cmbListOfItems_NotInList(NewData As String, Response As Integer)

DoCmd.OpenForm "FormToOpen", acNormal, "", "", acAdd, acNormal

End Sub

This opens up the form in data entry mode.

Cheers,

J

S.Clark said:
I don't understand how the combo calls the form, but...

the DoCmd.openForm method has an OpenArgs parameter. You could pass a
value, and in the form's OnOpen, look to see what the value is, and react to
it.

If me.openargs = "The combobox called me so go to a new rec" then
docmd.gotorecord acnewrec
end if

Maybe pick a shorter value than that, though. :D

j_gold said:
Sorry, should have clarified. The form that the combo box uses is also used
separately so that the user can scroll through and make changes to the
entries. If I set the forms data entry property to yes I cannot view all
records. If I use the OnOpen Event then I am always taken to a new record.

What I want is to have it go to a new record only if the combobox has called
the form.

J


S.Clark said:
Either:
1. Set the Form's [Data Entry] property to Yes.
2. Enter this code into the OnOpen Event of the Form

DoCmd.GotoRecord acNewRec

:

Hi, I have a combo box control which allows edits to the list items by
specifying a List Items Edit Form.

When I go to add an entry through the "edit" button that
appears when I click on the combobox it goes to the first record of the form
used to edit. I want users to be taken to a blank form and not see any other
records. Is this possible?

Thanks,

J Gold
 
J

j_gold

Hi Frank, thanks for the suggestion, and I thought of doing that, but I
really didn't want to create more forms than necessary.

I posted the solution to S. Clark's suggestion, adding a couple of
parameters that did the trick nicely :).

Cheers,

J

Frank H said:
The list items edit form should be used only for that purpose.
Why not just make a separate form, just to add new records. Or you can copy
the form you are using, name it differently, and reuse it. Then you can use
it's property sheet in design view to make it an add only form; if I recall,
the property name is DataEntry only, or something like that.
This way you won't need any VBA. (I think! I haven't tried this yet in 2007.)
--
Frank H
Rockford, IL


j_gold said:
Sorry, should have clarified. The form that the combo box uses is also used
separately so that the user can scroll through and make changes to the
entries. If I set the forms data entry property to yes I cannot view all
records. If I use the OnOpen Event then I am always taken to a new record.

What I want is to have it go to a new record only if the combobox has called
the form.

J


S.Clark said:
Either:
1. Set the Form's [Data Entry] property to Yes.
2. Enter this code into the OnOpen Event of the Form

DoCmd.GotoRecord acNewRec

:

Hi, I have a combo box control which allows edits to the list items by
specifying a List Items Edit Form.

When I go to add an entry through the "edit" button that
appears when I click on the combobox it goes to the first record of the form
used to edit. I want users to be taken to a blank form and not see any other
records. Is this possible?

Thanks,

J Gold
 

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