473,472 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to set the values of SourceObject,LinkChildFields,LinkMaster fields at Runtime?

26 New Member
Hi All,

I have a form SearchTestDetails ,which when loads first time , shows all the records from a table.Linkchildfields , LinkMasterFields set null and sourceobject has the table name.

Its has text fields where a user can enter search criterian,and on clicking ok the same form should load with filtered data.

after filtering , also Linkchildfields , LinkMasterFields set null and sourceobject has the table name , same.


Expand|Select|Wrap|Line Numbers
  1. Set frmTempForm = New Form_SearchTestDetails
  2.    With frmTempForm
  3.       .RecordSource = strSql
  4.       .Visible = True
  5.       '.Visible=True
  6.    End With
wherestrSql is the query prepared based on the search criterian.But it doesn't work


I also did
Expand|Select|Wrap|Line Numbers
  1. With db
  2. Set qdf = .CreateQueryDef("tmpTestInfo", strSql)
  3. DoCmd.OpenQuery "tmpTestInfo"
  4.  
  5. Set frmTempForm = New Form_SearchTestDetails
  6.    With frmTempForm
  7.       .RecordSource = tmpTestInfo
  8.       .Visible = True
  9.       '.Visible=True
  10.    End With
  11.  
  12.  
  13. .QueryDefs.Delete "tmpTestInfo"
  14. End With
  15. db.Close
  16. qdf.Close
here tmpTestInfo , when i see , after execution of the third line , i see correct resultset in tmpTestInfo but
at the line .RecordSource = tmpTestInfo , if i hold the mouse over tmpTestInfo it shows as nothing.

i also tried this , setting values of the above mentioned fields at run time.

Expand|Select|Wrap|Line Numbers
  1. With db
  2. Set qdf = .CreateQueryDef("tmpTestInfo", strSql)
  3. DoCmd.OpenQuery "tmpTestInfo"
  4. Set frm = New Form_SearchTestDetails
  5. [Form_SearchTestDetails].subSearchTestDetails.SourceObject = tmpTestInfo
  6. [Form_SearchTestDetails].subSearchTestDetails.LinkChildFields = ""
  7. [Form_SearchTestDetails].subSearchTestDetails.LinkMasterFields = ""
  8.  
  9. Set frmTempForm = New Form_SearchTestDetails
  10.    With frmTempForm
  11.       .RecordSource = strSql
  12.       .Visible = True
  13.       '.Visible=True
  14.    End With
  15.  
  16.  
  17.  
  18. .QueryDefs.Delete "tmpTestInfo"
  19. End With
  20. db.Close
  21. qdf.Close
but while setting LinkChildFields i get a warning message as "The setting you entered isn't valid for this property."..ans also when tried this thrid was same thing happens for tempTestInfo, it shows nothing.


On the fly , i need to set the property values.

Need urgent help !!

Thanks in advance
Titli
Apr 20 '11 #1
1 2847
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
To open a form it must be prefixed with a Form_, so if your form is named Customers, it would be :
Expand|Select|Wrap|Line Numbers
  1. Dim myFrm as Form_Customers
  2. Set myFrm=New Form_Customers 
If your form is already named Form_SearchTestDetails as I suspect, then you must add another Form_ in front of it.

Other then that, please go over your post again. You state "it doesn't work" which is woefully inadequate to help you. Doesn't work covers a whole lot of problems, from a crashing application, to a compile error to unexpected behavior. You need to tell us more about whats happening.

Also LinkChildFields and LinkMasterFields are both properties that can only be modified in Design view, or in the Open procedure of the form.

In your second "try" the reason you see "nothing" when mousing over .RecordSource = tmpTestInfo is because you have written tmpTestInfo as a variable which it is not. Please remember to turn on Option Explicit at the top of your module and save both our time. The .RecordSource is a property of type string. If you want to set its recordsource to a query named tmpTestInfo you need to use:
Expand|Select|Wrap|Line Numbers
  1. .RecordSource = "tmpTestInfo"
Apr 22 '11 #2

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

Similar topics

0
by: Mark | last post by:
Hi - I've got a really strange problem I can't explain - when I add new values into my database (Access) ir multiplies them by 100 - for example id I enter the values: 10.50 7.50 5.50 They...
2
by: Gawie Marais | last post by:
hi all, i have a form and would like to check two fields. if field 1 containes the letter 'c' and the other field contains 'undefined', then an error should apprear ina box on the screen. can...
3
by: MLH | last post by:
I have a query, qryAppend30DayOld260ies that attempts to append records to tblCorrespondence. When run, it can result in any of the following: appending no records, appending 1 record or appending...
0
by: aky | last post by:
Hi Im performing Parameter Fields Runtime Customization for crystal reports through VS.NET 2003, using C# as code Behind the ParameterFieldName property (and the other properties such as...
0
by: Sehboo | last post by:
Hi, I have a webpage with two text fields, and a button. Text fields are for Names and phonenumber. Once user clicks on the button, the form does some processing. Problem is that I have a...
2
by: mmcquade.forums | last post by:
I've built a CROSSTAB query that will list attendance for classes. Since the ATTENDANCE table tracks if someone was ABSENT with a yes/no field, the results of the crosstab show "-1" if checked. ...
1
by: rose1 | last post by:
In C#.net (windows Application) enter the values directly in MSFlegrid in Runtime using C#.net
6
rezme
by: rezme | last post by:
Allow me to preface this with a disclaimer: I'm self taught in C#, basically I type code in from what I've found on the web, and try to get it to do what I want it to. I'm sure there's a lot of us...
16
by: questionit | last post by:
Hi I am trying to write a code in HTML , maybe will use javascript if required. The code will open a webpage and type in username and password in the fields automatically and click the submit...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.