Results 1 to 2 of 2
  1. #1
    ColPat is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    25

    Lookup Table For Listbox Input

    Hi, I have a table "tbWorkOrder" with fields WONumber (Integer), EqID (text), EqDescription (text), EqLocation (text), plus 15 other fields.

    Form has listbox (lbWorkOrders) which is linked to table tbWorkOrder, row source is linked by query builder, list records in the table.
    Command button "unhides" listbox which lists the records.
    I want to be able to double click on a record and have all fields for that particular record displayed in the relevant text boxes on my form.

    Have the below code but when it gets to the line Me.Bookmark it fails with message "no current record"

    I have similar code working from a combo box on another form and it works ok.

    Can anyone help with why this particular code fails. Many thanks Colin

    Private Sub lbWorkOrders_Click()

    Dim strWO As Integer


    Dim rsViewWO As Recordset

    strWO = lbWorkOrders.Column(0)

    Set rsViewWO = Me.Recordset.Clone

    rsViewWO.FindFirst "[EqID] = " & strWO & ""
    If Not rsViewWO.NoMatch Then
    MsgBox "Record Not Found"
    Else

    Me.Bookmark = rsViewWO.Bookmark
    txWONumber = [tbWorkOrder.WONumber]
    cbEquipID = [tbWorkOrder.EqID]
    txEquipDesc = [tbWorkOrder.EqDescription]
    txEquipLoc = [tbWorkOrder.EqLocation]
    txReceivedBy = [tbWorkOrder.ReceivedBy]
    txWODate = [tbWorkOrder.WODate]
    txEmployeeID = [tbWorkOrder.EmployeeID]
    txFirstName = [tbWorkOrder.FirstName]
    txLastName = [tbWorkOrder.LastName]

    End If
    Set rsViewWO = Nothing
    Me.txWONumber.SetFocus
    Me.lbWorkOrders.Visible = False

    End Sub

  2. #2
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209

    Lookup Table For Listbox Input

    You are referring to the RecordsetClone of the Form. Have you set the Record Source Property of the Form to the Query that you are using for the Listbox? If not try changing that and try again.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-25-2010, 09:03 AM
  2. Use of Lookup Column Versus Listbox
    By P5C768 in forum Access
    Replies: 2
    Last Post: 02-25-2010, 02:00 AM
  3. Table Values As Query Input?
    By joolio in forum Access
    Replies: 2
    Last Post: 01-05-2010, 07:32 AM
  4. Replies: 0
    Last Post: 12-21-2009, 12:15 AM
  5. Multi-select listbox and update flag in table
    By Suresh in forum Programming
    Replies: 0
    Last Post: 12-19-2007, 01:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums