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 / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Open form and display a  blank record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
freedomverse - 28 May 2008 18:26 GMT
I have a form with a button that has the following code:

Private Sub New_Story_Button_Click()

   DoCmd.OpenForm "Story", , , , , acDialog
   Me.Stories_Detail.Form.Story.Requery

End Sub

The button opens the "Story" form -- if I want the "Story" form to display a
new, blank record when it opens what is the best way to go accomplish this?

Regards,
jared.
fredg - 28 May 2008 19:55 GMT
> I have a form with a button that has the following code:
>
[quoted text clipped - 10 lines]
> Regards,
> jared.

DoCmd.OpenForm "Story", , , , acFormAdd, acDialog
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

freedomverse - 28 May 2008 20:36 GMT
that is close but I also want to see the other records in the split
datasheet.  Any other ways?

> > I have a form with a button that has the following code:
> >
[quoted text clipped - 12 lines]
>
> DoCmd.OpenForm "Story", , , , acFormAdd, acDialog
fredg - 28 May 2008 21:26 GMT
> that is close but I also want to see the other records in the split
> datasheet.  Any other ways?
[quoted text clipped - 15 lines]
>>
>> DoCmd.OpenForm "Story", , , , acFormAdd, acDialog

You will find it helpful, when asking for assistance, if you give all
of the information needed the first time.

DoCmd.OpenForm "Story", , , , , acDialog,"GoToNew"

Code the "Story" form's Load event:

If Me.OpenArgs = "GoToNew" Then
   DoCmd.RunCommand acCmdRecordsGoToNew
End If

The above will open the form "Story" in Dialog at a new record, but
you will have the ability to then scroll existing records.

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

freedomverse - 29 May 2008 02:00 GMT
Thank you very much!  

Just for the sake of learning something new I have one more question.  Is
there any reason not to put the code that you mentioned

DoCmd.RunCommand acCmdRecordsGoToNew

in the load event of the form that I want to open?  Is it just another way
to skin a cat or is there a proper way to do this?

Thank you for all your help,
Jared.
fredg - 29 May 2008 17:23 GMT
> Thank you very much!  
>
[quoted text clipped - 8 lines]
> Thank you for all your help,
> Jared.

Please include the relevant portion of any previous message in your
new messages, as I have with my replies to you. You may remember what
the previous message was about because it pertained to you. I
certainly don't remember your previous messages, therefore I have to
spend unnecessary time searching for them. It also makes this current
question understandable to others who may also benefit from the reply.
It's just a common courtesy.

So that others can follow this post, your other posts indicated you
wish to open a form, using code, at a new record entry, yet still
allow the user to scroll existing records.
Here is the relevant portion of my reply to that previous message.
*************
DoCmd.OpenForm "Story", , , , , acDialog,"GoToNew"

Code the "Story" form's Load event:

If Me.OpenArgs = "GoToNew" Then
   DoCmd.RunCommand acCmdRecordsGoToNew
End If

The above will open the form "Story" in Dialog at a new record, but
you will have the ability to then scroll existing records.
*************

I don't understand your question here.
The RunCommand   ** IS ** placed in the "Story" form's Load event.
It's wrapped inside the If Me.OpenArgs = .... End If statement so that
ONLY if the OpenArgs = "GoToNew" will the form open to a new record.

If you open the "Story" form from a different form or directly from
the application it will open to the first record, not a new record.

If always want it to open to a new record, and still allow scrolling
old records, then all you need is the RunCommand statment (without the
If.. End If), and there is no need for any OpenArgs at all.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
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.