home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

requery subform in MS Access

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1805
Discussions: 200,950, Posts: 2,379,448, Members: 246,312
Old January 15th, 2003, 11:47 AM   Digg it!   #1 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: New Hampshire, USA
Posts: 641
requery subform in MS Access

I am trying to simplify data entry in a database.

Basically I want to have a user select something analagous to a customer name from a combo box and display all the records related to that customer within a subform. By displaying the records within a subform (datasheet view) the data entry person can see the customer's order history and continue adding records from the same screen.

I have tried the following based upon the CLICK event of the combo box and have not been able to get the subform to display relevant information relevant to the value selected within the combo box:

1 - [forms]![frmDataEntry]![frmSubform].Refresh
2 - DoCmd.ShowAllRecords
3 - docmd.requery frmSubform
4 - frmSubform.Requery
5 - DoCmd.RepaintObject acForm, "[Forms]![frmDataEntry]![frmSubform]"
6 - [forms]![frmDataEntry]![frmSubform].Requery
7 - me.refresh


Any thoughts?
ctaylor is offline   Reply With Quote
Old January 15th, 2003, 12:01 PM     #2 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: New Hampshire, USA
Posts: 641
I figured it out - at least in my circumstance...

1 - I stored the value selected within the combo box
2 - I ran the query selecting customer records against that stored value
3 - I deleted the subform from the form and recreated it. This time there was no defined relationship between the combo box and the subform.

This allowed me to requery the subform and display results without being constrained by a relationship between the subform and the combo box.

When this was done I was able to just specify the DoCmd.Requery to get things to work.

When there was a defined link between the combo box and the subform MS Access would not allow me to requery the subform becouse of this link.

thanks everyone

Last edited by ctaylor : January 17th, 2003 at 05:58 PM.
ctaylor is offline   Reply With Quote
Old January 15th, 2003, 12:06 PM     #3 (permalink)
ph34r t3h g04t
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 19,558
Blog Entries: 7
Hey, that's a good one. I'm going to write that down. I can put this to use. Thanks ctaylor!
Whir is offline   Reply With Quote
Old January 15th, 2003, 12:17 PM     #4 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: New Hampshire, USA
Posts: 641
WHIR

glad you like it.

the actual database has a main form where command buttons in the margin set and requery the contents of the subform. the subform which would be used for data entry also contained a subform showing the "order history"

just remember that if you are writing VBA coding to autocomplete values within the subform, that you need to remember what controls will exist within the specified instance of the subform. When the subform displayed changes, the controls and control names displayed within the subform will change and your VBA code will need to explicitly apply to "instantiated" controls. (The access wizards cannot help you with the contents of a subform so you will have to code this part manually.)
ctaylor is offline   Reply With Quote
Old January 17th, 2003, 01:30 AM     #5 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
You can actually do this with way less overhead--if you've initially opened the recordset to all records you might use.

Example:


Private Sub Combo9_Change()
Dim str As String
str = Combo9.Text
searchField.SetFocus
DoCmd.FindRecord str
End Sub



Finds the specific records based on the combo's value.
Creosote is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
The disrespect of Obama by Russian .. (35)
Making Health Care Worse (177)
Wireless Televisions. (12)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Regular Build (7)
radeon x850xt platinum & shader.. (6)
Is the PSU I received dead? (12)
Print spooler problem (15)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
windows vista security holes (9)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Foreign voltage (10)
Recent Discussions
windows vista security holes (10)
EVGA 9800 gtx help with finding a goo.. (9)
Internet Lost (2)
Point and Shoot Camera Suggestions. (4)
Regular Build (7)
Multiple Restarts Required at Boot (2)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Laptop with wireless problem. (2)
Hp Artist Edition + Matching Bag (0)
My monitor won't turn on after instal.. (0)
Asus P4G8X Mobo (6)
Xbox 360 GTA: SA disk error (1)
Is the PSU I received dead? (12)
windows 7 internet problem (5)
BSOD On Startup (ntoskrnl.exe) (2)
Print spooler problem (15)
Have you switched yet? (86)
screen resolution vs monitor size (2)
sms storage to PC (0)
Open With ..... Win7 (0)


All times are GMT -4. The time now is 12:29 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28