Results 1 to 5 of 5

Thread: Update a field

  1. #1
    Join Date
    May 2003
    Location
    UK
    Posts
    233

    Unanswered: Update a field

    I have two forms “frmCust” and “frmReturns” both with there own tables.

    I have a combo box “cmbCust” on the ”frmReturns” that looks up customers. There is sometimes a need to search for customers by the “frmcust”.

    What I want to do is when the customer is found in “frmCust” click on a button that will then update “cmbCust” on “frmReturns” with the selected record.

  2. #2
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    when you say update do you mean add that customer to the actual tabl/query/list of the recordsource behind the combobox?

  3. #3
    Join Date
    May 2003
    Location
    UK
    Posts
    233
    yes I want to add the customer to the table and then add additional information through the form that relates to that customer.

    Thus, creating one record in the table

    ie Customer, type of query, action to be taken, date, etc

  4. #4
    Join Date
    May 2003
    Location
    UK
    Posts
    233
    Last Call!!!

    Can anyone help?

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    you want to add a record to table tblXYZ which contains fields fldThis, fldThat, fldOther, fldLast.

    private sub TheNameOfYourButton_Click()
    dim dabs as dao.database
    dim recs as dao.recordset
    set dabs=currentdb
    set recs =dabs.openrecordset("tblXYZ")
    recs.addnew
    'you did it! one record added to tblXYZ !!

    'you can now add data in this new record
    'e.g. literals
    recs!fldThis = "This string will be stored in fldThis

    'or e.g. variables that are in scope
    recs!fldThat = myVariable

    'or e.g. from boxes on a form
    recs!fldOther = Forms!ThisForm!ThatSubform.whateverBox.value

    'or e.g. the bound value of a combo
    recs!fldLast = mycombo.value

    'now you need to do the equivalent of clicking the pencil in table-view
    recs.update

    exit sub


    is that what you wanted?

    izy

Posting Permissions

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