473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

need held with a subform

84
I have an unbound form (A). The form contains lists boxes that get information from different tables. When the form is opened the lists are populated with various bits of data. The operator will select certain items from the list boxes.

I have a query (Z) that uses the information the operator selects on form (A). This information is listed in the criteria section of the query.

I have a form (B) that is bound to query (Z).

On form (A) I have a command button that will open form (B). This works great.
All data from query Z is displayed.

I created a subform (C) on form (A) that should display the results that appear in form (B). I am not sure how to change the command button code to make this happen. Does anyone have any idea's? I have listed the command code I am currently using.


Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "B"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command34_Click

End Sub
May 3 '07 #1
12 1657
Rabbit
12,516 Expert Mod 8TB
You'll want the button to requery the subform.
May 3 '07 #2
sesling
84
You'll want the button to requery the subform.
ok. would I keep the existing code in the onclick command or would that need to change? if so, how?
May 3 '07 #3
Rabbit
12,516 Expert Mod 8TB
You'll need to change it because I'm assuming you want to go with a subform instead of using a second form. So obviously you'll want to get rid of that line.

A requery is usually done using the Requery method of the control.
May 3 '07 #4
sesling
84
You'll need to change it because I'm assuming you want to go with a subform instead of using a second form. So obviously you'll want to get rid of that line.

A requery is usually done using the Requery method of the control.

Sorry but I am not following what needs to be done. How would I change the current command control (see original post) to run the requery? How would I reference the subform in the requery command? Don't I still need to call the original form or query to get the data to display?
May 3 '07 #5
Rabbit
12,516 Expert Mod 8TB
Sorry but I am not following what needs to be done. How would I change the current command control (see original post) to run the requery? How would I reference the subform in the requery command? Don't I still need to call the original form or query to get the data to display?
The requery is simply Me.subformcontrol.Requery. I'm not sure what you mean by calling the original form or query to get the data to display.
May 3 '07 #6
sesling
84
The requery is simply Me.subformcontrol.Requery. I'm not sure what you mean by calling the original form or query to get the data to display.
My new command button (on-click) code is listed below. FILETYPE is the name of the subform. When I click on the command button I do not see the results of the query. If I go into edit mode on the form and then back to view the results are populated on the form. Am I missing another step?

Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

Me.FILETYPE.Requery

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command34_Click

End Sub
May 3 '07 #7
Rabbit
12,516 Expert Mod 8TB
Try Me.Filetype.Form.Requery
May 4 '07 #8
sesling
84
Try Me.Filetype.Form.Requery
Tried that and got the same result. Are there any other things I can try?
May 4 '07 #9
sesling
84
Try Me.Filetype.Form.Requery
I think I found what I was doing wrong. See my code below. This seems to work.

Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

Me.FILETYPE.sourceObject = "queryZ"

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command34_Click

Me.Filetype.Form.Requery

End Sub

However this leads to my next issue. On the subform are file records that contain ID's. When I use the original form that the subform is based on I can double click on the file and the ID is passed to another query and those results appear on the screen. Again my query criteria has forms!formB!FILEID. Now that the information is being displayed in the subform how can I get the double click option to work? When I look at the properties for the subform there are no options for onClick or onDblClick. When I double click on the item i get a screen pop up that requests to value for forms!formB!FILEID. I tried changing the query criteria to forms!FILETYPE!.ID but that did not work. I know how to pass a value from a form to a query but is it even possible to pass a value from a subform to a query? If so, how?
May 4 '07 #10
Rabbit
12,516 Expert Mod 8TB
I think I found what I was doing wrong. See my code below. This seems to work.

Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

Me.FILETYPE.sourceObject = "queryZ"

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command34_Click

Me.Filetype.Form.Requery

End Sub

However this leads to my next issue. On the subform are file records that contain ID's. When I use the original form that the subform is based on I can double click on the file and the ID is passed to another query and those results appear on the screen. Again my query criteria has forms!formB!FILEID. Now that the information is being displayed in the subform how can I get the double click option to work? When I look at the properties for the subform there are no options for onClick or onDblClick. When I double click on the item i get a screen pop up that requests to value for forms!formB!FILEID. I tried changing the query criteria to forms!FILETYPE!.ID but that did not work. I know how to pass a value from a form to a query but is it even possible to pass a value from a subform to a query? If so, how?
To refer to a control on a subform you use Forms!MainForm!SubformControl.Form.ControlName
May 4 '07 #11
sesling
84
To refer to a control on a subform you use Forms!MainForm!SubformControl.Form.ControlName

That worked. Thanks for all your help!
May 4 '07 #12
Rabbit
12,516 Expert Mod 8TB
Not a problem, good luck.
May 4 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jeremiah J. Burton | last post by:
I am trying to create a database (in Acces 2000) to track my fossil collection. I have a main table that has records for every specemen. I have a secondary table with information on localities...
2
by: Ellen Manning | last post by:
Using A2K. I've got a form with 2 subforms (a subform within a subform). When the user enters an amount on the main form, I place that amount in subform1 with no problem but can't seem to get it...
9
by: Susan Bricker | last post by:
Greetings. I am having trouble populating text data that represents data in my table. Here's the setup: There is a People Table (name, address, phone, ...) peopleID = autonumber key There...
2
by: Susan Bricker | last post by:
Greetings. Before I begin, I have been stuck on this problem for about a 5 days, now. I have tried and just seem to be not getting anywhere. I know that the explanation is lengthy, but I am a...
1
by: Eric | last post by:
There are two sub forms in main form. One has values: Outlet Equipment 2 ABCBCBD 3 DKJDKJD 4 KDJKDJK Second has also a variable name outlet. I need help how to i display the...
1
by: shenanwei | last post by:
I have db2 v8.2.5 on AIX V5.3 with all the switches on Buffer pool (DFT_MON_BUFPOOL) = ON Lock (DFT_MON_LOCK) = ON Sort ...
3
by: suek | last post by:
I have a table with over 4000 records to search upon, and the users don't like a combo box. So what I have been trying to do for the last twelve hours is do some code to get a text box to search. ...
5
by: blakerrr | last post by:
Hi everyone, I have a form called Master Order with a subform in it called Order Info. The subform has a nested subform in it called Order Details. Master Order cycles through all of the parts...
1
by: Dave | last post by:
Hello, I know that I can use the Parent property to get the name of the form that a subform is on, but what if I need the name of the subform/ subreport "box" on that form that contains my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.