Results 1 to 2 of 2
  1. #1
    triplee23 is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    2

    Popup form

    Hi,

    I am trying to build a chemical lab result database and have have some difficulties in getting my form for result input to work. Here is the situation (somewhat simplified):

    I have three tables : Articles<-on-to-many->Specifications<-one-to-many->SamplingPlan
    All tables have corresponding forms: frmArticle (single form), frmSpecification(cont.form), frmSamplingPlan(cont.form)

    The fields keeping the relationships together are:

    kp_ArticleID <-> kf_ArticleID/kp_SpecifiationID <-> kf_SpecificationID

    I have a frmArticles with the frmSpecifications as subform. In the frmSpecifications subform I have a button that opens a popup window with the following VBA code:

    Private Sub SamplingPlan_Click()


    Dim strWC As String
    strWC = "kf_SpecificationID = " & Me!kp_SpecificationID
    DoCmd.OpenForm "frmSamplingPlan", , , strWC, acFormEdit, acDialog, Me!kp_SpecificationID
    End Sub

    In order to get the relationship field values set I have the following code on frmSamplingPlan (popup window) load:

    Private Sub Form_Load()
    DoCmd.MoveSize (1440 * 0.78), (1440 * 1.8)
    Me!kf_SpecificationID.DefaultValue = """" & Me.OpenArgs & """"
    Me.AllowAdditions = False
    End Sub

    I also add AllowAdditions = false in order to hide the (new) record at the bottom of the continuous form.

    I then have the following code to be able to add records:

    Private Sub AddNewRecord_Click()
    Dim rst As DAO.Recordset

    Me.AllowAdditions = True

    Set rst = Me.Recordset
    rst.AddNew
    rst.Update

    Me.Description.SetFocus

    Me.AllowAdditions = False

    End Sub

    The problem with this is that the defaultvalue is removed and the relationship to the new records disappears. It is the rst.update that removes the defaultvalue.

    Anyone with an idea on how to solve this?

    //Triplee23

  2. #2
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    It's just my opinion but it seems like a lot of extra work for little benefit. If you don't want people to use the navigation buttons at the bottom, just set them not to display in the Form properties. If you still want to give users the ability to navigate from record to record, it's a lot easier to add custom navigation buttons to your form than it is to rewrite the way Access processes records.

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

Similar Threads

  1. Popup Form
    By NISMOJim in forum Forms
    Replies: 1
    Last Post: 10-23-2010, 09:16 AM
  2. popup when opening a form
    By ajetrumpet in forum Forms
    Replies: 1
    Last Post: 10-08-2010, 09:33 AM
  3. Replies: 10
    Last Post: 09-27-2010, 08:06 PM
  4. Replies: 0
    Last Post: 06-14-2010, 09:41 AM
  5. Form-Subform-Popup Problem
    By TrudyD1474 in forum Forms
    Replies: 1
    Last Post: 06-10-2010, 05:36 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