Results 1 to 5 of 5
  1. #1
    keith701a is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    15

    Another Form Question

    I have built my form mentioned in my other post. I am now having a problem entering data into it. I have it set "yes" for data entry, yet it is pulling existing dummy records I have entered. Some fields on certain subforms can be edited while others on different subforms cannot.



    I just need the whole form to be for new records only. I am going to build another similar form for existing one.

    Thanks in advance.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,891
    I would use one form for both new and existing records. I use VBA code to control the mode a form opens to.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    keith701a is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    15
    Thanks for the reply, I've been on days off hense the delay in replying. Is there anyway to get a sample of said code? Half of my issue is my lack of familarity with VBA, I've been scraping it together as I go along from other sources.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,891
    Here is example of how I open same form for different purposes:

    for edit mode:
    DoCmd.OpenForm "form name", , , "Submit.LabNum='" & strLabNum & "'", , , "Edit"

    for view only:
    DoCmd.OpenForm "form name", , , "Submit.LabNum='" & strLabNum & "'", acFormReadOnly, , "ViewData" & ":" & strSource

    for new record:
    DoCmd.OpenForm "form name", , , acFormAdd, , "New"

    Then code behind the opened form:
    Code:
    Private Sub Form_Open(Cancel As Integer)
    With Me
    If .OpenArgs Like "View*" Then
        .AllowEdits = False
        .tbxRet.ControlSource = "Ret"
        .tbxRet.BackColor = RGB(204, 255, 204)
        If .OpenArgs = "ViewData:Button" Then
            .btnCancel.Caption = "Quit Data View"
            .btnFinish.Caption = "&Continue"
            .btnFinish.SetFocus
        ElseIf .OpenArgs = "ViewData:DoubleClick" Then
            .btnFinish.Visible = False
            .btnCancel.Caption = "Close"
        End If
    End If
    End With
    End Sub
    However, I have not done this with form/subform arrangement but should work.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    dblife's Avatar
    dblife is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2011
    Location
    South Shields, UK
    Posts
    104
    sneaky way to learn useful vba - i found useful..
    if you use the button creation wizard in access and then go into the code, play around with the commas where the arguments are and you will see all the options..

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Form question
    By Daryl2106 in forum Access
    Replies: 1
    Last Post: 12-02-2011, 04:10 PM
  2. Question form
    By zimonestones in forum Forms
    Replies: 10
    Last Post: 11-27-2011, 04:56 PM
  3. form question
    By kathi2005 in forum Forms
    Replies: 7
    Last Post: 11-07-2011, 04:14 PM
  4. Sub-Form Question
    By amcglone in forum Forms
    Replies: 2
    Last Post: 06-07-2010, 10:33 AM
  5. Question about Form
    By ACM in forum Programming
    Replies: 3
    Last Post: 10-09-2009, 04:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums