Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Posts
    5

    Unanswered: I need to have my subform show updated table

    I am using an unbound form to populate a table (tblTheGoods). I also wanted the user to be able to see the table they are updating in a subform. Thats easy enough, except when they submit the data from the main form you have to close and reopen the form to see the change. I already have an OnClick event built into the submit button, would it be easy to refresh my subform and corresponding table in the same block of code? or would I make another block.. I am new to this. My mainform is Unbound, but the subform is bound. Here is the code I use to update my unbound table.. would this be the spot I would tell it to refresh the subform OnClick?

    I am using ACCESS 2003


    Private Sub MethodSubmitForm_Click()
    Dim strSQL As String
    strSQL = _
    "INSERT INTO tblTheGoods " & _
    "(Date_Entered, Stock_num, VIN_num, Car_Make, Car_Model, Car_Color, Car_Seller, Buyer, Buyer_Fee, Period, Trans_Cost, Miles, Car_Cost, Car_Year)" & _
    " VALUES (" & _
    "'" & Me.tboDate & "', " & _
    "'" & Me.tboStockNum & "', " & _
    "'" & Me.tboVIN & "', " & _
    "'" & Me.cboCarMake & "', " & _
    "'" & Me.cboCarModel & "', " & _
    "'" & Me.cboColor & "', " & _
    "'" & Me.cboSeller & "', " & _
    "'" & Me.cboBuyer & "', " & _
    "'" & Me.cboBuyerFee & "', " & _
    "'" & Me.cboPeriod & "', " & _
    "'" & Me.tboTransCost & "', " & _
    "'" & Me.tboMiles & "', " & _
    "'" & Me.tboCarCost & "', " & _
    "'" & Me.cboYear & "')"


    CurrentDb.Execute strSQL, dbFailOnError
    End Sub

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try:
    Code:
    Me.SubForm.Requery
    Have a nice day!

  3. #3
    Join Date
    Dec 2011
    Posts
    5

    thanks

    Ok I will..

    After the values list
    I will make a new line
    With? Double quotes like this


    "'" & Me.SubForm.Requery "'"

  4. #4
    Join Date
    Dec 2011
    Posts
    5

    ok got it

    No double quotes.. seems to work. Still needs some tweaking. thanks

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You must place the instruction on a seperate line, after executing the query.
    Have a nice day!

Posting Permissions

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