How can I reflect changes to table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ejamnadas
    New Member
    • Oct 2008
    • 9

    #1

    How can I reflect changes to table

    I have an unbound form, whose combobox and textboxes are also unbound.

    The form's record source is a query (getdata) .
    It has combo box whose rowsource is the same query. The afterupdate event for the combobox assigns a column from the query, (Document_Contr ol_Number), + 1, to a textbox in the form.

    When the form is submitted, the values are added into the table, but when I make a selection in the combobox, it does not use the updated Document_Contro l_Number to assign a value to the textbox

    I want the form to reflect the changes in the table.

    I tried Form.requery, but this didn't seem to work.
    Does anybody have a suggestion?
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Originally posted by ejamnadas
    I have an unbound form, whose combobox and textboxes are also unbound...

    The form's record source is a query (getdata) .
    I think we'd all be interested to know how you did this! If the form has a record source, by definition, the form is bound, not unbound! Which begs the question of why have a bound form with unbound textboxes?

    We need to know whether your form is bound or not and whether your textboxes are bound or not. Also how are you "submitting the form?"


    Linq ;0)>

    Comment

    • ejamnadas
      New Member
      • Oct 2008
      • 9

      #3
      Originally posted by missinglinq
      I think we'd all be interested to know how you did this! If the form has a record source, by definition, the form is bound, not unbound! Which begs the question of why have a bound form with unbound textboxes?

      We need to know whether your form is bound or not and whether your textboxes are bound or not. Also how are you "submitting the form?"


      Linq ;0)>
      Thank you for the reply Linq. I used a solution that is working: Upon submitting the form, I run a macro to close and open the form, and the updated value in the table is reflected. I dont know if this is the best solution.

      I actually was using a record source for the form but it turned out the form works the same without that record source. The form is unbound, and the textboxes and comboboxes are all unbound.

      To submit the form, it connected to the database and opens the table, then adds each of the object values to the table fields. Here is some code:

      Set cnn1 = New ADODB.Connectio n
      mydb = "H:\DataManagem ent.mdb"
      strCnn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & mydb
      cnn1.Open strCnn

      ' Open Document Control Table table.
      Set rstdatamanageme nt = New ADODB.Recordset
      rstdatamanageme nt.CursorType = adOpenKeyset
      rstdatamanageme nt.LockType = adLockOptimisti c
      rstdatamanageme nt.Open "tblDocumentCon trol", cnn1, , , adCmdTable


      'get the new record data
      rstdatamanageme nt.AddNew
      rstdatamanageme nt!Document_Con trol_Number = Document_Contro l_Number
      rstdatamanageme nt!Doc_Type_Num = Doc_Type_Num.Co lumn(0)
      rstdatamanageme nt!Document_Nam e = Document_Name
      .
      .
      rstdatamanageme nt.Update

      Comment

      Working...