Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Location
    Hamilton,Ontario
    Posts
    132

    Question Unanswered: DoCmd.GotoRecord

    Hi Every One:

    I am trying to Open "Inventory Professional" form and then Trying to Display new Rec


    SQLSTmt = "select * from [Inventory] Where [Item Number]='" & ItemNum & "'"
    Set adrs = curdb.OpenRecordset(SQLSTmt, dbOpenDynaset)
    If adrs.EOF = True Then
    response = MsgBox("Item Number Does Not Exist In Inventory Table,Would You Like To Add this Item in Inventory Table now?", vbYesNo, "Change To D2S")
    If response = ID_YES Then
    DoCmd.OpenForm "Inventory Professional", acNormal
    DoCmd.Maximize
    'I AM GETTING ERROR '2015" that i cant go to specified RECORD
    DoCmd.GoToRecord acDataForm, "Inventory Professional", acNewRec
    Else
    MsgBox "You Chose Not To Add This Item In Inventory Table, You Can Not Contiue", vbCritical, "Add Item To Inventory Table"
    adrs.Close
    Set adrs = Nothing
    Exit Function
    End If
    End If




    'I AM GETTING ERROR '2015" that i cant go to specified RECORD
    DoCmd.GoToRecord acDataForm, "Inventory Professional", acNewRec


    any Help will be appreicated.
    Thanx in advance

  2. #2
    Join Date
    Nov 2002
    Location
    Hamilton,Ontario
    Posts
    132
    forgot to mention that above code is in Module not behind any form.

  3. #3
    Join Date
    Oct 2002
    Location
    Greensboro, NC
    Posts
    50

    Re: DoCmd.GotoRecord

    put this in the on open property of your form - DoCmd.GoToRecord acDataForm, "Inventory Professional", acNewRec

    tjacobs

    Originally posted by VBAPROGRAMMER
    Hi Every One:

    I am trying to Open "Inventory Professional" form and then Trying to Display new Rec


    SQLSTmt = "select * from [Inventory] Where [Item Number]='" & ItemNum & "'"
    Set adrs = curdb.OpenRecordset(SQLSTmt, dbOpenDynaset)
    If adrs.EOF = True Then
    response = MsgBox("Item Number Does Not Exist In Inventory Table,Would You Like To Add this Item in Inventory Table now?", vbYesNo, "Change To D2S")
    If response = ID_YES Then
    DoCmd.OpenForm "Inventory Professional", acNormal
    DoCmd.Maximize
    'I AM GETTING ERROR '2015" that i cant go to specified RECORD
    DoCmd.GoToRecord acDataForm, "Inventory Professional", acNewRec
    Else
    MsgBox "You Chose Not To Add This Item In Inventory Table, You Can Not Contiue", vbCritical, "Add Item To Inventory Table"
    adrs.Close
    Set adrs = Nothing
    Exit Function
    End If
    End If




    'I AM GETTING ERROR '2015" that i cant go to specified RECORD
    DoCmd.GoToRecord acDataForm, "Inventory Professional", acNewRec


    any Help will be appreicated.
    Thanx in advance

Posting Permissions

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