Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / February 2006

Tip: Looking for answers? Try searching our database.

OPen form to new record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gavin - 15 Feb 2006 19:06 GMT
I have a data entry form for my database and want it to open up at a new
record each time I open it. I'm sure I had an example of this filed away on
my PC somewhere but I can't find it! Can someone remind me please?

Regards,

Gavin
Rick Brandt - 15 Feb 2006 19:11 GMT
> I have a data entry form for my database and want it to open up at a
> new record each time I open it. I'm sure I had an example of this
> filed away on my PC somewhere but I can't find it! Can someone remind
> me please?

Set the DataEntry property of the form to Yes.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

gavin - 15 Feb 2006 19:22 GMT
> > I have a data entry form for my database and want it to open up at a
> > new record each time I open it. I'm sure I had an example of this
> > filed away on my PC somewhere but I can't find it! Can someone remind
> > me please?
>
> Set the DataEntry property of the form to Yes.

Is it really that simple? I hang my head in shame  :-(  Thanks very much,
Rick!

Gavin
Brian Bastl - 15 Feb 2006 22:01 GMT
In addition to what Rick wrote, if you want to open it to a new record but
be able to view/edit other records through this form as opposed to using it
strictly for data entry, then you'll want a slightly different approach.

Set its DataEntry property to No.

In those instance where you want to open it in DataEntry mode, specify it in
the DoCmd statement

DoCmd.OpenForm "MyForm ,,,,acFormAdd

Otherwise, you can use the following to take you to a new record, but allow
you to view and edit existing records:

DoCmd.OpenForm "MyForm"
DoCmd.GoToRecord ,, acNewRec

Brian

> > > I have a data entry form for my database and want it to open up at a
> > > new record each time I open it. I'm sure I had an example of this
[quoted text clipped - 7 lines]
>
> Gavin
gavin - 16 Feb 2006 18:36 GMT
> In addition to what Rick wrote, if you want to open it to a new record but
> be able to view/edit other records through this form as opposed to using it
[quoted text clipped - 14 lines]
>
> Brian

Hi Brian,
Thanks for the reply - I'm not very experienced with VBA - where do I put
this code?

Regards,

Gavin
Brian Bastl - 16 Feb 2006 19:12 GMT
1. Open form in design view
2. Right-click on its title bar
3. Select Properties to open the form's property sheet

If you only want to use the form for data entry and not for editing, then
click the "All" tab and then find the line for Data Entry. Change this from
No to Yes.

If you always want to begin at a new record but also allow existing records
to be view and edited in the same form instance, then you have two options.
******************************************
Option 1 (not always the best approach): follow steps 4 thru 10.

4. Click on the "Events" tab
5. Click on the words "On Load"
6. Directly to the right, click the down arrow and select [Event Procedure]
7. Directly to the right of that, there will be a button which looks like
[...]
8. Click it to open the vba editor
9. You'll now see some text which looks like the following:
Private Sub Form_Load()
End Sub

On a blank line between those two, you'd type:
DoCmd.GoToRecord ,, acNewRec

10. Click the "Save" button and then on the application's menu bar, go to
Debug | Compile. If you get no errors, close the editor, and then the form.
Then re-open the form normally to see if it works like you want.
****************************************

Option 2 uses a command button on another form:

Follow steps 1 - 3, but obviously opening a different form
Add a command button by clicking on the toolbox
Follow the Wizard dialogue
When finished, right click the new command button and click "Build" to open
the vba editor. On a blank line directly following "DoCmd.OpenForm .....

type: DoCmd.GoToRecord ,, acNewRec

See #10 above
*******************************************

HTH,
Brian

> > In addition to what Rick wrote, if you want to open it to a new record but
> > be able to view/edit other records through this form as opposed to using
[quoted text clipped - 25 lines]
>
> Gavin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.