Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Posts
    2

    Unanswered: Combo box problem? Form problem? db problem?

    I am entering data about "Items" into that table using a form based on a query. Some fields in the table "Item" relate to autonumber primary keys in other tables using lookups.

    In my data entry form I have used combo boxes based on the lookups to attach ID codes to the "Items" records. In the attached tables I have tried to anticipate the choices to be selected, but will need to also add new records (and related autonumbers).
    How can I add new entries to the attached tables and to the combo list using the combo box?

    Also, my data entry form only reflects the ID code in the record field, how can I make it show the text?

    Help - I'm nearing a deadline!!!

  2. #2
    Join Date
    Jun 2002
    Posts
    2
    It's me again - I've made some progress. I've resolved my issue of text showing in the fields by changing the data type of the lookup fields from numbers/IDs to text and then relating the tables according to text fields. (The tables are set to"No Duplicates.")

    I still need urgent help with measures to update my combo box list and the related table record by data entry from the form. I've tried the following code on the "OnNotInList" event procedure:

    Private Sub Format_NotInList(NewData As String, Response As Integer)
    Dim db As Database, rs As Recordset
    Dim strMsg As String
    strMsg = "'" & NewData & "' is not an available Format name"
    strMsg = strMsg & " Do you want to associate the new name to the current list?"
    strMsg = strMsg & " Click Yes to link or No to re-type it."
    If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
    Response = acDataErrContinue
    Else
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Format", dbOpenDynaset)
    On Error Resume Next
    rs.AddNew
    rs!Format = NewData
    rs.Update

    If Err Then
    MsgBox "An error occurred. Please try again."
    Response = acDataErrContinue
    Else
    Response = acDataErrAdded
    End If
    End If
    End Sub


    However, I get an error message that there is a type mismatch on the following section of code, last line;

    Else
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Author", dbOpenDynaset)


    Does this error have anything to do with the fact that I am trying to enter a new record in a table other than "Item"?

    I will be extremely appreciative of any help - !!!!

Posting Permissions

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