problem getting form to update table

Ziggy1

Registered User.
Local time
Today, 05:03
Joined
Feb 6, 2002
Messages
462
Hi, thanks in advance...


I have a main form with a subform, on the sub I have a button to bring up another form to make some selections which enter the data to the subform in one action... so this works perfectly... My issue is I also add Modify options so after the user makes their initial selections they may choose to edit right away without leaving record.

The problem I am encountering is even though I can see the records are saved in the table, the subform does not appear to see it in code ( visually it shows the new records but not this “update” )... even switching records doesn’t matter... the only way it does work is if I go and add a new record ( main) or open/close the form.... Please understand that it is this single field that won't update (after adding the records) in the table on the newly added records....it's like it doesn't know they are there???

So this is the code on my update form, after the user enters new records, they click a button open the form, then click a button on the form which executes the update... like i said it works but not on a fresh record.

I have ... DoCmd.RunCommand acCmdSaveRecord and DoCmd.RunCommand acCmdSaveRecord all over the place trying to figure out why it won’t work?

Code:
Private Sub cmdUpdateMarkup_Click()

DoCmd.RunCommand acCmdSaveRecord
    

DoCmd.SetWarnings False

Dim strSQL As String
Dim MKUP As Integer

MKUP = Me.txtMarkup_update

strSQL = "UPDATE tblQdetail SET tblQdetail.Markup = " & MKUP & vbNewLine
strSQL = strSQL & "WHERE (((tblQdetail.QuoteID_FK)=[Forms]![tblQHeader]![cobQID]));"

DoCmd.RunSQL strSQL

Forms![tblQHeader]![frmQdetail].Requery

DoCmd.SetWarnings True

DoCmd.Close acForm, "frmupdatemarkup"

End Sub
 
grr I always do this to myself..

I was referring to the wrong control

cobQID... should have been txtQHeadID

so don't mind me :) Thanks if you started looking
 

Users who are viewing this thread

Back
Top Bottom