Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Aug 2001
    Location
    Chewelah, Washington, USA
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    BeforeInsert Example (2002 SP-1)

    I would like to use an example that Helen Feddema shows in Access 2002 Inside/Out, but don't really understand three items. It is a BeforeInsert form event that automatically saves the next higher number in a series to be used for an ID field.

    <pre> ....
    Dim lngID As Long
    Me![subGaplessID].Form.Requery
    lngID = Me![subGaplessID].Form![txtMaxID] + 1
    Me![ID] = lngID
    Me![txtID].Requery

    .....</pre>


    I don't really understand what "[txtMaxID], "Me.[ID]", and "[txtID]" are and how to put them in my database's primary field HospStayID. Thanks for the help. <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: BeforeInsert Example (2002 SP-1)

    >>I don't really understand what "[txtMaxID], "Me.[ID]", and "[txtID<<

    txtMaxID and txtID are probably textboxes on the form. ID is probably just a field in the recordsource behind the form; it probably is the control source for txtID.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Lounger
    Join Date
    Aug 2001
    Location
    Chewelah, Washington, USA
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: BeforeInsert Example (2002 SP-1)

    Thanks for the response. The txtMaxID is still confusing to me. Would she have put that in the form to point to the last record in the recordset?

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: BeforeInsert Example (2002 SP-1)

    txtMaxID is a control in the subform. It is probably set to give the MAX number currently in use.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •