Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    15

    Unanswered: error to save data using data control!

    hi,
    can somebody please check for me the below coding:
    Private Sub cmdSave_Click()
    With Data1.Recordset
    .AddNew
    !oprid = txtOprID
    !name = txtName
    !type = cboType.Text
    End With
    Data1.Refresh

    txtOprID = ""
    txtName = ""
    cboType.Text = ""
    End Sub

    the error is at the .AddNew.why??please help me!!

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450
    Question what is cboType for controle a textbox or combobox


    if textbox
    Private Sub cmdSave_Click()
    With me.Data1
    .Recordset.AddNew
    .Recordset("oprid") = me.txtOprID.text
    .Recordset("name") = me.txtName.text
    .Recordset("type") = me.cboType.text
    .update
    .refresh
    End With

    me.txtOprID.text= ""
    me.txtName .text= ""
    me.cboType.Text = ""
    End Sub

    if combobox or listbox
    Private Sub cmdSave_Click()
    With me.Data1
    .Recordset.AddNew
    .Recordset("oprid") = me.txtOprID.text
    .Recordset("name") = me.txtName.text
    .Recordset("type") = me.cboType.boundtext
    .refresh
    End With


    me.txtOprID.text= ""
    me.txtName .text= ""
    me.cboType.boundtext= ""

Posting Permissions

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