Multiple Data Entry in Access

Discussion in 'MS Access' started by BELEHU, Jun 17, 2011.

  1. BELEHU

    BELEHU New Member

    Joined:
    Jun 17, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have table1 and table2

    In table1 I have

    stID (PK)
    Name
    dateOfBirth
    schoolId

    in table2 I have

    serviceId(PK)
    serviceType
    stId

    the two tables are related using the stID key

    stID is numerical field starting 100 and I have about 200 records in the first table
    Now, Single data entry for one person is working fine using a single form
    I just type stID and the service type value.
    Now what I want is that once I enter the service value for one person let say stID 145 then I also want the service type value to enter for the rest 199 individuals automatically
    Is it possible ???
    Thanks in advance
     
  2. apr pillai

    apr pillai New Member

    Joined:
    Dec 17, 2010
    Messages:
    16
    Likes Received:
    12
    Trophy Points:
    0
    Occupation:
    Auditor
    Location:
    India
    Home Page:
    http://www.msaccesstips.com/
    Copy and Paste the following Code into the Form Module with appropriate changes to refer the Controls correctly:

    Code:
    Private Sub ServiceType_DblClick(Cancel As Integer)
    Dim getval, rst As Recordset, bkmark As String
    Dim bkmksave As String
    
    Me.Refresh
    bkmksave = Me.Bookmark
    
    getval = Nz(Me![ServiceType], 0)
    If getval = 0 Then
       Exit Sub
    End If
    Set rst = Me.RecordsetClone
    rst.MoveFirst
    Do While Not rst.EOF
        rst.Edit
        rst![ServiceType] = getval
        rst.Update
        bkmark = rst.Bookmark
        Me.Bookmark = bkmark
        rst.MoveNext
    Loop
    rst.Close
    Me.Bookmark = bkmksave
    
    Set rst = Nothing
    End Sub
    
    
    Enter the required change of Value in the ServiceType field and Double_Click on the field to make changes to all the records and come back to the record where you have made the change initialy.

    You can see the changes happening on all the records one by one.
     
    shabbir likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice