By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

Editing a record pulled from subform

P: n/a
I have a subform in continuous form style that I use to populate 3
fields (textboxes) on my main form with a double-click of the key-field
textbox of the sub:

Private Sub TextBattID_DblClick(Cancel As Integer)
Forms![Battery Data].[BattID] = Me![Text1]
Forms![Battery Data].[Brand] = Me![Text2]
Forms![Battery Data].[CurrentPrice] = Me![Text3]
End Sub

This populates my textboxes fine, but I'd really like to use this form
to edit my records also. I'd like to change the values in my mainform
textboxes and do a Forms![Battery Data].Requery.
I've tried this and I get debug errors.
Any ideas? Thanks
B. Panwala

Oct 12 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

pa*************@yahoo.com wrote:
I have a subform in continuous form style that I use to populate 3
fields (textboxes) on my main form with a double-click of the key-field
textbox of the sub:

Private Sub TextBattID_DblClick(Cancel As Integer)
Forms![Battery Data].[BattID] = Me![Text1]
Forms![Battery Data].[Brand] = Me![Text2]
Forms![Battery Data].[CurrentPrice] = Me![Text3]
End Sub

This populates my textboxes fine, but I'd really like to use this form
to edit my records also. I'd like to change the values in my mainform
textboxes and do a Forms![Battery Data].Requery.
I've tried this and I get debug errors.
Any ideas? Thanks
B. Panwala
You need to set the Dirty property of your subform to False to force
the save. Requery just reqeries the subform - it doesn't force a save.

Oct 12 '06 #2

P: n/a
I'm not sure where to place the Diry property:

In my original code I had a save button I would hit after I modified a
displayed field:

Private Sub SaveBatteryChange_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
End Sub

I also had a subform refresh button with this code:

Forms![BatteryListSubform].Requery

So where should I place the Dirty?

Syntax like this?
Forms![BatteryListSubform].Dirty = False

I tried this in the code for the refresh button. Should I place it in
the Save block of code?

On a similar form where I'm adding a battery, the Requery works to
refresh the subform.

Thanks!
pi********@hotmail.com wrote:
pa*************@yahoo.com wrote:
I have a subform in continuous form style that I use to populate 3
fields (textboxes) on my main form with a double-click of the key-field
textbox of the sub:

Private Sub TextBattID_DblClick(Cancel As Integer)
Forms![Battery Data].[BattID] = Me![Text1]
Forms![Battery Data].[Brand] = Me![Text2]
Forms![Battery Data].[CurrentPrice] = Me![Text3]
End Sub

This populates my textboxes fine, but I'd really like to use this form
to edit my records also. I'd like to change the values in my mainform
textboxes and do a Forms![Battery Data].Requery.
I've tried this and I get debug errors.
Any ideas? Thanks
B. Panwala

You need to set the Dirty property of your subform to False to force
the save. Requery just reqeries the subform - it doesn't force a save.
Oct 13 '06 #3

P: n/a
I'm not sure where to place the Diry property:

In my original code I had a save button I would hit after I modified a
displayed field:
Private Sub SaveBatteryChange_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
End Sub

I also had a subform refresh button with this code:

Forms![BatteryListSubform].Requery

So where should I place the Dirty?

Syntax like this?
Forms![BatteryListSubform].Dirty = False

I tried this in the code for the refresh button. Should I place it in
the Save block of code?

On a similar form where I'm adding a battery, the Requery works to
refresh the subform.

Thanks!

pi********@hotmail.com wrote:
pa*************@yahoo.com wrote:
I have a subform in continuous form style that I use to populate 3
fields (textboxes) on my main form with a double-click of the key-field
textbox of the sub:

Private Sub TextBattID_DblClick(Cancel As Integer)
Forms![Battery Data].[BattID] = Me![Text1]
Forms![Battery Data].[Brand] = Me![Text2]
Forms![Battery Data].[CurrentPrice] = Me![Text3]
End Sub

This populates my textboxes fine, but I'd really like to use this form
to edit my records also. I'd like to change the values in my mainform
textboxes and do a Forms![Battery Data].Requery.
I've tried this and I get debug errors.
Any ideas? Thanks
B. Panwala

You need to set the Dirty property of your subform to False to force
the save. Requery just reqeries the subform - it doesn't force a save.
Oct 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.