Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002

    Unanswered: This is killing me. Please help.

    I created a form for people to enter new sales requests. The cmbid field generates a new request id when the user clicks the add new button. The new record generates but if the user clicks the add new button but closes out of the form before entering any information then reopens the form the newest id appears (like it should) but the fields are filled in with another record's information. They should be blank since the user never filled them in. My cmdid_afterupdate works fine. Please help. I'm assuming the Form Load should contain this code. Here is what I have:

    This shows the correct id but the rest of the fields are not right:

    Private Sub Form_Load()

    Dim oldid As Double, newid As Variant, rst1 As Recordset, str As String
    str = "select [Request ID] from Sales order by [Request ID]"
    Set rst1 = CurrentDb.OpenRecordset(str)
    oldid = rst1![Request Id]
    newid = Val(oldid)
    cmbid = newid
    Set rst1 = Nothing

    This works when the user selects the request id from the drop menu:

    Private Sub cmbid_AfterUpdate()

    Dim db As Database, rs As Recordset, savename As String

    Set db = CurrentDb
    savename = cmbid
    cmbid = savename
    Set rs = Me.RecordsetClone
    rs.FindFirst "[Request Id] = " & cmbid
    If rs.NoMatch Then
    MsgBox "Error locating id."
    Exit Sub
    Me.Bookmark = rs.Bookmark
    End If

    If frmStatus.Value = 2 Then
    cmbreason.Enabled = True
    cmbreason.Value = ""
    cmbreason.Enabled = False

    End If

    End Sub

  2. #2
    Join Date
    Apr 2002

    Re: This is killing me. Please help.

    It's like the form does not recognize that the request id and fields are related. Anyone?

Posting Permissions

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