Results 1 to 4 of 4

Thread: Why doesn't this code work for updating the recordset?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Brisbane, Qld, Australia
    Posts
    78

    Post

    Hi, I have a program where when you edit it brings up all the data. the user can edit the fields but some fields wont update. the code i have for text boxes is:

    mrstrans as recordset

    fldName = "Source"
    mRstrans.Fields(fldName).ValidateOnSet = True
    mRstrans.Fields(fldName) = TxtDetails(15).Text

    Now this works fine but if i want a combo box to update it spits the dummy. The code i have for that is :

    fldName = "Status"
    mRstrans.Fields(fldName).ValidateOnSet = True
    mRstrans.Fields(fldName) = CmbType.ItemData(CmbCmbType.ListIndex)

    cmbgender is the combo box. it comes up on the form no probs but if ya edit it it dont do jack. Now my question is: Am i using the right coding to get this to update the combo box selected? Any help would be great.

  2. #2
    New Member
    Join Date
    Jun 1999
    Location
    Cape Town, South Africa
    Posts
    2

    Post

    Instead of using this :

    mRstrans.Fields(fldName) = CmbType.ItemData(CmbCmbType.ListIndex)

    could you not use

    mRstrans.Fields(fldName) = CmbType.text

    ??

  3. #3
    New Member
    Join Date
    Jun 1999
    Location
    India
    Posts
    2

    Post

    I need a clarification from your end. The code which you have given has the following line :

    CmbType.ItemData(CmbCmbType.ListIndex)

    Are you sure, the value which you want to write in the recordset is coming from the combox "Cmbtype" as the listindex is returning the currently index of combobox "CmbCmbType", which is diferent from "CmbType"

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Brisbane, Qld, Australia
    Posts
    78

    Post

    Parth Wrote:

    I need a clarification from your end. The code which you have given has the following line :
    CmbType.ItemData(CmbCmbType.ListIndex)

    Are you sure, the value which you want to write in the recordset is coming from the combox "Cmbtype" as the listindex is returning the currently index of combobox "CmbCmbType", which is diferent from "CmbType"

    No i am not sure about the value coming from the combo box. How would i check to make sure it is coming from that?

    Well i have these lines in my initialise combos sub :
    CmbType.AddItem "Active"
    CmbType.ItemData(CmbType.NewIndex) = 1
    etc... over and over up to 4 indexes...

    now what i want is it to load what is in the databse already say index 1 meaning active in the combo box but i also want it to update the database if i select say number 2 index.
    As for "cmbcmbtype", i am unsure myself what you mean. Basically the line i have given you doesn't update properly but i have used the same line in other projects and it has worked so i am lost for ideas. Thanx for trying to help and understand. If you get something from this then let me know.

Posting Permissions

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



Click Here to Expand Forum to Full Width