473,320 Members | 1,961 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,320 software developers and data experts.

How to reference subform from a popup form

374 256MB
Hi all,

I am having some trouble, I am trying to create an advanced search form which will open up as a popup from my main search from.

I am using the Allen Browne method of creating the where string however I am setting the recordsource of the subform with a constructed sql string, not filtering.

My main form contains a subform which my basic search selects perfectly. However I cant seem to be able to get my advanced search to point down to the sub form correctly. I usually get the error "This object does not support this property or method" which keeps poping up everytime I close resulting in having to close access through task manager.

Below is the code I use to point to the record source of the main forms sub form:

Expand|Select|Wrap|Line Numbers
  1.     'Finally, apply the string as a query of the recordsource
  2.  
  3.     Dim topinsert2 As String
  4.  
  5.  
  6.     If comboNrecords2 = "All" Then
  7.  
  8.     topinsert2 = "All "
  9.  
  10.     Else
  11.  
  12.     topinsert2 = "TOP " & comboNrecords2 & " "
  13.  
  14.     End If
  15.  
  16.    Forms!frmlogforfiltering!subfrmlogforfiltering.RecordSource = "Select " & topinsert2 & " * FROM logforfiltering WHERE " & strwhere2
  17.  
my main form: frmlogforfiltering

my sub form: subfrmlogforfiltering

my advanced search form: frmAdvancedSearch


Thanks for any help,

Chris
Jul 28 '10 #1

✓ answered by MikeTheBike

@munkee
Hi

I think this may do it
Expand|Select|Wrap|Line Numbers
  1. Forms!frmlogforfiltering!subfrmlogforfiltering.Form.RecordSource = "Select " & topinsert2 & " * FROM logforfiltering WHERE " & strwhere
I believe (assume) that 'subfrmlogforfiltering' is the form's subform CONTROL, and not the subform itself. To access the subform's controls and properties you must refer to the Form object CONTAINED in the subform control.

It is confusing because Access gives the sub form control the same name as the sub form it contains by default (but you are given the opertunity to change it).

In later versions of Access 2003+ I prefer to use this form, not sure why, but probably because I never took thr trouble to understand Bangs(!)
Expand|Select|Wrap|Line Numbers
  1. Form_frmlogforfiltering.subfrmlogforfiltering.Form.RecordSource = "Select " & topinsert2 & " * FROM logforfiltering WHERE " & strwhere
Of course, this may not be the problem!

HTH


MTB

1 2889
MikeTheBike
639 Expert 512MB
@munkee
Hi

I think this may do it
Expand|Select|Wrap|Line Numbers
  1. Forms!frmlogforfiltering!subfrmlogforfiltering.Form.RecordSource = "Select " & topinsert2 & " * FROM logforfiltering WHERE " & strwhere
I believe (assume) that 'subfrmlogforfiltering' is the form's subform CONTROL, and not the subform itself. To access the subform's controls and properties you must refer to the Form object CONTAINED in the subform control.

It is confusing because Access gives the sub form control the same name as the sub form it contains by default (but you are given the opertunity to change it).

In later versions of Access 2003+ I prefer to use this form, not sure why, but probably because I never took thr trouble to understand Bangs(!)
Expand|Select|Wrap|Line Numbers
  1. Form_frmlogforfiltering.subfrmlogforfiltering.Form.RecordSource = "Select " & topinsert2 & " * FROM logforfiltering WHERE " & strwhere
Of course, this may not be the problem!

HTH


MTB
Jul 28 '10 #2

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

Similar topics

0
by: Deano | last post by:
I have a main/subform arrangement which works well. The main form's parent records are about employees. The subform calculates their salary. I have now decided that the user can enter some...
0
by: RookieCard | last post by:
I've been stuck on this for 2 days. Here's the deal. I am working (3 levels down/deep)in a subform within a tab object that is within another tab obeject. Everything works great! Except here: 1)...
4
by: bill.brennum | last post by:
Hi, This is probably a question with a simple answer, but here goes. I have a form linked to a table. There is a field on that table that while not showing on the form, I would like to...
3
by: jburris | last post by:
I have been through enough of these threads to think that this should be an easy fix... but, are there circumstances in which the following code syntax does not work? =!!.Form! (this is out of...
4
by: SteveS | last post by:
Hello. This is a strange problem which does not make sense to me. I open a popup page with the following javascript code: function OpenDenyWindow(changeId) {...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
4
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
9
by: rousseaud | last post by:
I'm having some trouble getting popup forms to work properly. I have a main form that contains 4 fields that I want to fill in by using a series of 4 popup forms that I initiate by clicking a...
2
by: Del | last post by:
I have a popup form that consist of a single field called EnteredBy and a Subform that has three fields. The popup form also has a button in the Form Footer called close. In the On Click event I...
7
by: EManning | last post by:
I have an A2003 database linked to SQL Server 2005. My problem is with a popup form with a filtered table as a recordsource. I set the filter with an SQL statement like this: SELECT * FROM...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.