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

Updating a subform using a query

P: n/a
I have a query that works, but then displays the results in a datasheet
view. The query is reliant on the results of a combo box, and when i
update this combo box and click a button the results of the select
query are displayed in a data sheet. What i would like is for the
results to be displayed in a subform on this form possibly in a series
of txt boxes and memo boxes, but if not, a data sheet view will be
fine.

I have this kind of thing after the button is clicked to show the query
in a seperate datasheet wondered if it was adaptable to display in a
subform.

Private Sub Command4_Click()
On Error GoTo Err_Command4_Click

Dim stDocName As String

stDocName = "tblTarget Query1"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If you create a form based on the query (assuming it's a select query),
and drop it into your form as a subform then you can do this. the code
behind your button would be something like

'run the update query
DoCmd.OpenQuery "Insert the name of your update query here"

'requery and refresh the subform
Me!Subform1.Form.Requery
Me!Subform1.Form.Refresh

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.