Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jul 2003
    Thanked 0 Times in 0 Posts

    Asterisk on my Record Selector! (Access 2000)

    I have written code which extracts values from a multi-select listbox(on form"1"), opens another form (call it form "A"), and pastes these values, then closes this form(A). It works once. When I run it a 2nd time, the code runs but the record started (in form A) doesn't write to the table. I have to close and open form 1 to get it to work again. Here's what I noticed:
    1)At before update, on form A: a pencil is in the record selector, and the new values are filled in.
    2)At Close, on form A: An "*" is in the record selector, and the values are gone.
    I recently converted this app from 97 to 2000. It used to work in 97.
    Any ideas?
    Thanks, Ralph

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Asterisk on my Record Selector! (Access 2000)

    You will have to provide more details. How are you pasting the selected values in form A? As a single record (if so, how?), or a separate record for each value? What is the code you use?

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Asterisk on my Record Selector! (Access 2000)

    Details were posted in <post#=338408>post 338408</post#> which has now been locked. Let's keep this in a single thread, please.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Asterisk on my Record Selector! (Access 2000)


    If you want to react, please post a reply in this thread, not a new post. In the header of each post, you will see some icons on the right hand side, among which the "Reply to this post" icon: <IMG SRC=>. Clicking it will allow you to compose a reply in the same thread. See <!help=08>Help 08<!/help> for more details about posting, replying etc.

    About your problem: since you haven't posted the code you are using, I don't know why it misbehaves. However, I see no need to open a form and paste records into it. I would use DAO or ADO to append records directly to the underlying table. Here is an example using DAO. It is intended to be placed and used in the code module of form "1". You will need to modify it to work in your situation; in particular, you must substitute the appropriate names of the table and its fields, and of the controls mentioned. You must set a reference to the Microsoft DAO 3.6 Object Library in Tools | References... before using this code.

    Sub AppendToTable()
    ' Declare variables
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim varItem As Variant

    ' Set error handling
    On Error GoTo ErrHandler

    ' Set object variables
    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("tblWhatever", dbOpenDynaset)

    ' Loop through selected items of list box
    For Each varItem In Me.lstStudents.ItemsSelected
    ' Create new record
    ' Get student ID from list box
    rst!StudentID = Me.lstStudents.ItemData(varItem)
    ' Other data from combo boxes, text boxes etc., add more if necessary
    rst!AbsenceType = Me.cbxItemType
    rst!Excused = Me.chkExcused
    rst!AbsenceDate = Me.txtAbsenceDate
    ' Save record
    Next varItem

    ' Clean up and get out
    On Error Resume Next
    Set rst = Nothing
    Set dbs = Nothing
    Exit Sub

    ' Inform user, then clean up
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
    End Sub

Posting Permissions

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