Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2003
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding new Record (2000)

    I have a form that I have an add new button on it. When I click on the add new, I want to be able to add a new resolution and carry over the CtyBoardMtgID from the last record I was viewing to this new resolution. I've tried and tried, and I can't get it to work. Please help. The last code I have on the OnClick property is:

    Dim db As Database
    Dim varcb As Integer

    Set db = DBEngine.Workspaces(0).Databases(0)

    varcb = Me!CtyBoardMtgID

    DoCmd.GoToRecord , , acNewRec

    DoCmd.RunSQL "UPDATE Resolutions SET CtyBoardMtgID = " & varcb & _
    " WHERE CtyBoardMtgID = 0"
    [Resolution Number].SetFocus

    Thanks for your help!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding new Record (2000)

    You're making it more complicated than necessary. You don't need update queries for this, you can simply set the value of CtyBoardMtgID (if it's not an AutoNumber field):

    Dim varcb As Integer

    ' Get current value
    varcb = Me!CtyBoardMtgID

    ' Go to new record
    DoCmd.GoToRecord , , acNewRec

    ' Set value
    Me!CtyBoardMtgID = varcb

    ' Set focus
    [Resolution Number].SetFocus

  3. #3
    Lounger
    Join Date
    Mar 2003
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding new Record (2000)

    Thanks! It worked!

Posting Permissions

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