Results 1 to 7 of 7

Thread: Dao

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Dao

    Ok i have a combo box that is suppose to fill in the other fields.
    I have got this code to fill the combobox but how do i male it fill in the other fields ????

    VB Code:
    1. Private Sub Form_Load()
    2.     Data3.Refresh
    3.     With Data3.Recordset
    4.         .MoveFirst
    5.         Do Until .EOF
    6.             cboMembershipNo.AddItem (.Fields("MembershipNumber"))
    7.             .MoveNext
    8.         Loop
    9.     End With
    10. End Sub

    that works fine, i just need to know how to make it fill in the relevant information.
    Im Learning !!!!

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Dao

    What do you mean, fill the cboMembershipNo with all the fields from Data3.recordset?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Re: Dao

    i have resolved my first problem but i have come accoress another one.

    VB Code:
    1. Private Sub cmdDelete_Click()
    2.  
    3.     On Error GoTo DataError
    4.  
    5.     With Data3.Recordset
    6.         Data3.Recordset.Delete
    7.         Data3.Recordset.Fields("MembershipNumber") = cboMembershipNo.Text
    8.         Data3.Recordset.Fields("FullName") = txtName.Text
    9.         Data3.Recordset.Fields("Address") = txtAddress.Text
    10.         Data3.Recordset.Fields("DateOfBirth") = txtDateOfBirth.Text
    11.         Data3.Recordset.Fields("TelephoneNumber") = txtTelephone.Text
    12.         Data3.Recordset.Fields("OtherInfo") = txtAddInfo.Text
    13.         Data3.Refresh
    14.     End With
    15.    
    16.     Exit Sub
    17.  
    18. DataError:
    19.     MsgBox Err.Description
    20.    
    21. End Sub

    it doens't delete the record until i close the application completly any ideas how i get around this ??????
    Im Learning !!!!

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Dao

    Try....

    VB Code:
    1. Private Sub cmdDelete_Click()
    2.  
    3.     On Error GoTo DataError
    4.  
    5.     With Data3.Recordset
    6.         Data3.Recordset.Delete
    7.         [B]Data3.Refresh[/B]
    8.         Data3.Recordset.Fields("MembershipNumber") = cboMembershipNo.Text
    9.         Data3.Recordset.Fields("FullName") = txtName.Text
    10.         Data3.Recordset.Fields("Address") = txtAddress.Text
    11.         Data3.Recordset.Fields("DateOfBirth") = txtDateOfBirth.Text
    12.         Data3.Recordset.Fields("TelephoneNumber") = txtTelephone.Text
    13.         Data3.Recordset.Fields("OtherInfo") = txtAddInfo.Text
    14.         Data3.Refresh
    15.     End With
    16.    
    17.     Exit Sub
    18.  
    19. DataError:
    20.     MsgBox Err.Description
    21.    
    22. End Sub
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Re: Dao

    it gave me this error.

    Update or CancelUpdate without AddNew or Edit
    Im Learning !!!!

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Dao

    On what line did the error occured?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Dao

    Quote Originally Posted by Ricky1
    i have resolved my first problem but i have come accoress another one.

    VB Code:
    1. Private Sub cmdDelete_Click()
    2.  
    3.     On Error GoTo DataError
    4.  
    5.     With Data3.Recordset
    6.         Data3.Recordset.Delete
    7. [color=green]
    8. '---- delete may work
    9. '---- but you haven't opened the bit below for editting or adding a new record..
    10. '---- try the next line
    11.         Data3.Recordset.AddNew
    12. [/color]
    13.         Data3.Recordset.Fields("MembershipNumber") = cboMembershipNo.Text
    14.         Data3.Recordset.Fields("FullName") = txtName.Text
    15.         Data3.Recordset.Fields("Address") = txtAddress.Text
    16.         Data3.Recordset.Fields("DateOfBirth") = txtDateOfBirth.Text
    17.         Data3.Recordset.Fields("TelephoneNumber") = txtTelephone.Text
    18.         Data3.Recordset.Fields("OtherInfo") = txtAddInfo.Text
    19. [color=green]
    20. '---- Not sure if this line would be needed
    21.         Data3.Recordset.Update
    22. [/color]
    23.         Data3.Refresh
    24.     End With
    25.    
    26.     Exit Sub
    27.  
    28. DataError:
    29.     MsgBox Err.Description
    30.    
    31. End Sub

    it doens't delete the record until i close the application completly any ideas how i get around this ??????
    See highlighted bits above.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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