Re: Open a Form in Add Mode

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ripper (anonymous_at_discussions.microsoft.com)
Date: 03/25/04


Date: Thu, 25 Mar 2004 14:26:07 -0800

Thanks!

 Exactly what I needed. I have the kiddos click a finished button that closes the form, but I have seen a problem where their answers go blank. I know that they just are on a new record, but I can't figure out how they are doing that.

Rip
     
     ----- Dirk Goldgar wrote: -----
     
     "Ripper" <anonymous@discussions.microsoft.com> wrote in message
     news:BA440E22-1728-4325-B71A-0C9FAFA76A1E@microsoft.com
> I use this code to open a form. What I want is for the form to open
> up in add mode. My students are taking a test and I want them to
> only add 1 record each.
>> Dim stDocName As String
> Dim stLinkCriteria As String
> stDocName = "frmTest9"
> DoCmd.OpenForm stDocName, , , acNormal
>> Will this code work for what I want to do?
>> Thanks As Always,
> RIP
     
     Change this line
     
> DoCmd.OpenForm stDocName, , , acNormal
     
     to this:
     
         DoCmd.OpenForm stDocName, , , ,acFormAdd
     
     This will open the form in data-entry mode, so they only see a blank
     record to fill in. It will not, though, prevent them from adding more
     than one record. For that -- if that's what you want -- you'll need
     extra code; possibly something like this in the form's AfterInsert
     event:
     
         Private Sub Form_AfterInsert()
     
             DoCmd.Close acForm, Me.Name, acSaveNo
     
         End Sub
     
     --
     Dirk Goldgar, MS Access MVP
     www.datagnostics.com
     
     (please reply to the newsgroup)
     
     
     



Relevant Pages

  • Re: URGENT: Access Crash after System Update!
    ... Private Sub cmdFormulationZoom_Click ... Dim stDocName As String ... Dim stLinkCriteria As String ...
    (microsoft.public.access.formscoding)
  • Re: Format output to email problem
    ... "Les" wrote in message ... > Dim stDocName As String ... > Dim Rpt As String ...
    (microsoft.public.access.formscoding)
  • Re: empty form, blonde moment?
    ... It looks like the lack of additions/deletions did the ... >> Dim stDocName As String ... >> Dim stLinkCriteria As String ... >> Exit Sub ...
    (microsoft.public.access.forms)
  • Re: Form links not working
    ... rather than allenbrowne at mvps dot org. ... >> Dim stDocName As String ... >> Dim stLinkCriteria As String ... >> Exit Sub ...
    (microsoft.public.access.forms)
  • RE: button VS drop down
    ... Private Sub TR_PROBLEMCODESUFFIX_AfterUpdate ... Dim stDocName As String ... Dim stLinkCriteria As String ...
    (microsoft.public.access.formscoding)