 |
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

February 24th, 2006, 11:37 AM
|
Registered User
|
|
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Subform not displaying data
Hopefully I am just overlooking something simple here.
I have a simple db to track employee time. I need to view the records each week to verify that all employees have entered their time. I created a simple form with a text box to enter the Week Of: (Date ending in Saturday's date). After update then triggers my query to run based on the date entered. For some reason my query runs outside of my subform. If I click back on the form, enter design view and then go back to form view, the data displays correctly.
I think I have been staring at this too long as I can't seem to think what I might be doing wrong. Any suggestions or ideas would be helpful.
TIA
|

February 24th, 2006, 12:02 PM
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Make sure your event requeries/refreshes (try both, one should work) the subform after updating the query.
|

February 24th, 2006, 12:27 PM
|
Registered User
|
|
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can I ask where I would requery/refresh? Would I put it in my code as a DoCmd.Requery? I can't find an example of what I am trying to do in the books that I have. Aslo, why would the query run outside of the form in the first place? Sorry, I am interested in the why's as much as the answers.
TIA
|

February 24th, 2006, 03:12 PM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
|
|
So Steve, do I understand this correctly:
1) You have a form with a text box for the user to input the week ending date 2) This date is then used as a parameter in your query 3) and the results of the query are supposed to then display in a subform? (or another form?);
and the problem is the query results are not displaying in the subform? I don't quite understand what you mean by "my query runs outside of my subform." Could you explain a little more please?
Have you tried using me.refresh in the subform?
Loralee
|

February 24th, 2006, 04:10 PM
|
Registered User
|
|
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Loralee,
Thanks for responding. Yes do you understand correctly.:)
What I am seeing is the query results in a datasheet view taking the focus away from the form. In essence a seperate form rather than the subform output that I am looking for. By switching between the views I am essentially refreshing my view, but in order for that to work I have to leave the queries datasheet view open. If I close the query results prior to refreshing the views I have no data displayed in the subform.
Please bear with me as I am fairly new to this, but I thought that a subform should display the data that is passed to it from the query rather than having a query datasheet display and then having to refresh the form. If the datasheet is supposed to display then doesn't that clutter my form more than I want?
Thanks again for the help.
Steve
|

February 24th, 2006, 04:12 PM
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
If the update triggers an event code in VBA, then I assume you're either saving the query as a stand-alone entity, or setting the .RecordSource of the subform to the query definition. Either way, after doing that, the subform itself needs to be refreshed since its data source has changed. In order to do this from the VB function called by the update event, the syntax would be something like:
Me.subfrmName.Requery
or
Me.subfrmName.Refresh
Again, I can never remember which one does it right unless I'm doing the code myself.
|

February 24th, 2006, 05:29 PM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Steve,
It sounds like you may not actually have created a subform.
Did you actually drag the subform onto the form? (or use one of the other techniques to plant it there?)
If you're not sure, or what I'm saying is not making sense AND there is NO sensitive data in your MDB, would you want to e-mail it to me so I can see what you are seeing? (If you are going to e-mail it, what version are you working in?)
Loralee
|

February 24th, 2006, 06:05 PM
|
Registered User
|
|
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Loralee,
I did drag the subform onto the form and I do have the Link fields criteria filled out. Unless I missed a step somehow the form/subform does appear to be correct, so I'm not sure how I ended up with a subform that doesn't work correctly.
I am using 2k3 and have no problem e-mailing it to you..Thanks for offering to take a look!:)
Kindler,
I have tried to use both a VBA function and a Macro to run the query. In both instances the query displays in a seperate window and not in the subform. Refreshing the form will display the data but leaves the query's data in a seperate datasheet view, which is not ideal. I need to keep this as simple as possible for some of the users.
Thanks!
Steve
|

February 24th, 2006, 06:11 PM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Steve,
Can you get to my e-mail address from the Forum? If so, feel free to send it. I'm going to step away to run errands and will take a peak tonight or tomorrow.
Loralee
|
|
 |