Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 24th, 2006, 11:37 AM
Registered User
 
Join Date: Feb 2006
Location: , Ohio, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old February 24th, 2006, 12:02 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Make sure your event requeries/refreshes (try both, one should work) the subform after updating the query.

Reply With Quote
  #3 (permalink)  
Old February 24th, 2006, 12:27 PM
Registered User
 
Join Date: Feb 2006
Location: , Ohio, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #4 (permalink)  
Old February 24th, 2006, 03:12 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

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


Reply With Quote
  #5 (permalink)  
Old February 24th, 2006, 04:10 PM
Registered User
 
Join Date: Feb 2006
Location: , Ohio, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #6 (permalink)  
Old February 24th, 2006, 04:12 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Reply With Quote
  #7 (permalink)  
Old February 24th, 2006, 05:29 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

Reply With Quote
  #8 (permalink)  
Old February 24th, 2006, 06:05 PM
Registered User
 
Join Date: Feb 2006
Location: , Ohio, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #9 (permalink)  
Old February 24th, 2006, 06:11 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform not displaying values after adding updates jlangdon Access 1 April 23rd, 2008 03:00 PM
Displaying recordset into subform apmanzojr Access 1 October 17th, 2006 02:08 PM
count data from subform Vince_421 Access 1 May 27th, 2006 11:51 AM
Subform on many to many data aware Access 14 August 12th, 2005 02:36 AM
subform data in report exhibitor Access 4 May 16th, 2005 12:19 PM



All times are GMT -4. The time now is 11:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.