Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2002
    Posts
    21

    Lightbulb Unanswered: Help with current record on form.

    I created a form for people to enter work requests. If someone opens the form the most recent request (cmbid box) appears. Problem is that the rest of the fields are not updating. For instance, someone chooses to create a new request but closes before entering all the info, that person then reopens the form and the correct request id appears..but the fields are filled in with the previous request's info. The afterupdate event works (blank records should appear since the most recent request was not filled in). I tried the "me.[combobox name].requery" on the form load but still nothing happens.

    Thanks.

    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)
    rst1.MoveLast
    oldid = rst1![Request ID]
    newid = Val(oldid)
    cmbid = newid
    rst1.Close
    Set rst1 = Nothing

    Me.cmbid.Requery
    Me.cboClientCoverage.Requery
    Me.cmbProdManager.Requery
    Me.cmbclient.Requery
    Me.cmbcontact1.Requery
    Me.cbojobsite.Requery
    Me.cboCity.Requery
    Me.txtExpectedLoanCount.Requery
    Me.txthead.Requery
    Me.txtExpectedTapeDelivery.Requery
    Me.cmbreview.Requery
    Me.frmStatus.Requery
    Me.txtComments.Requery
    Me.txtStatus.Requery


    rivate Sub cmbid_AfterUpdate()

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

    Set db = CurrentDb
    savename = cmbid
    Me.Requery
    cmbid = savename
    Set rs = Me.RecordsetClone
    rs.FindFirst "[Request Id] = '" & cmbid & "'"
    If rs.NoMatch Then
    Beep
    MsgBox "Error locating id."
    Exit Sub
    Else
    Me.Bookmark = rs.Bookmark
    End If
    rs.Close
    Me.cmbid.Requery
    Me.cboClientCoverage.Requery
    Me.cmbProdManager.Requery
    Me.cmbclient.Requery
    Me.cmbcontact1.Requery
    Me.cbojobsite.Requery
    Me.cboCity.Requery
    Me.txtExpectedLoanCount.Requery
    Me.txthead.Requery
    Me.txtExpectedTapeDelivery.Requery
    Me.cmbreview.Requery
    Me.frmStatus.Requery
    Me.txtComments.Requery
    Me.txtStatus.Requery

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    After this line:

    Me.Bookmark = rs.Bookmark

    put in a me.refresh

    Plus, if you want to clear out the old data that was not accepted, you should do so in Form Open
    Last edited by jmrSudbury; 02-27-04 at 17:27.

  3. #3
    Join Date
    Apr 2002
    Posts
    21

    Hmm that did not work.

    The old data is still appearing. I don't understand it. When I click on say, request #1 from the drop down menu, all the fields change to the proper values...but when I add a new record (request #2) and leave the fields blank then close and reopen - #2 appears but the data values from #1 are displayed in the fields.

Posting Permissions

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