Open an Access Form based on a class : ADO DAO RDO RDS
This is a discussion on Open an Access Form based on a class within the ADO DAO RDO RDS forums in Framework and Interface Programming category; Hi, I've got two forms (search and detail). Each form has an own class (events: showing, saving etc.). The idea is to use a search form, having an output (ID, Name etc.) I'd like to open the detail form using an ID from the search form to show all record details. But how to pass to the detail form the ID-parameter? My detail form has a property ID, I want to set this property using the ID value from the search form. But I can only use docmd.openform("xxx") and there is no chace to pass the ID as a paramater. ...
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| I've got two forms (search and detail). Each form has an own class (events: showing, saving etc.). The idea is to use a search form, having an output (ID, Name etc.) I'd like to open the detail form using an ID from the search form to show all record details. But how to pass to the detail form the ID-parameter? My detail form has a property ID, I want to set this property using the ID value from the search form. But I can only use docmd.openform("xxx") and there is no chace to pass the ID as a paramater. I don't want to use something like that: docmd.openform("vv").recordsource = ID or something like that. Is this possible? Thanks for your help |
|
#2
| |||
| |||
| Lots of ways to skin this cat. 1) > My detail form has a property ID (from the Search form) DoCmd.OpenForm "vv" Do Until IsLoaded("vv") DoEvents Loop Forms("vv").ID =Me.ID (IsLoaded is a basic user-defined function available in Northwind and elsewhere.) Keep in mind that at this point the Form is already open, so the Open or Load events have already fired. You'd need to find another way to "tell" the form that it needs to do something with the information it just received. Let_ID could easily provide that functionality. Overall, this approach is probably more trouble than its worth considering the other available methods.. 2) Per Online VBA Help: DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs) -You can use either the WhereCondition or the OpenArgs arguments of OpenForm to pass information directly to the Detail form. DoCmd.OpenForm "vv",,, "ID = " & Me.ID DoCmd.OpenForm "vv",,,,,, Me.ID 3) -in the Open event of the Detail form, you can retrieve & react to the ID value of the Search form (assuming its still open). 4) -You could have your Search form set a global variable with the ID value and then use the Open event of the Detail form to retrieve & react to that value. HTH, "AndyWawa" <AndyWawa@discussions.microsoft.com> wrote in message news:CA963755-4C77-41B0-9464-CDDE1F7F46E9@microsoft.com... > Hi, > I've got two forms (search and detail). Each form has an own class > (events: > showing, saving etc.). The idea is to use a search form, having an output > (ID, Name etc.) I'd like to open the detail form using an ID from the > search > form to show all record details. But how to pass to the detail form the > ID-parameter? > My detail form has a property ID, I want to set this property using the ID > value from the search form. But I can only use docmd.openform("xxx") and > there is no chace to pass the ID as a paramater. I don't want to use > something like that: docmd.openform("vv").recordsource = ID or something > like > that. Is this possible? > Thanks for your help |
|
#3
| |||
| |||
| ' In a module Public Function IsOpen(strForm As String) As Boolean IsOpen = (SysCmd(acSysCmdGetObjectState, acForm, strForm) > 0) End Function ' In frm_search Private frm_detail As Form_frm_detail If IsOpen("frm_detail") And Not frm_detail Is Nothing Then frm_detail.CallingName = strSearchString Else DoCmd.OpenForm "frm_detail", _ DataMode:=acFormEdit, _ WindowMode:=acWindowNormal, _ OpenArgs:=Trim(CStr(lngExcursionID)) & "^" & strSearchString & "^" & Me.Name Set frm_detail = Application.Forms("frm_detail") End If ' ****In frm_detail***** Private ParentForm As Form Private ParentFormName As Variant Property Set ParentObject(fValue As Form) Set ParentForm = fValue ParentFormName = ParentForm.Name End Property Property Let CallingName(vValue As Variant) Me!dspSearchPhrase.Value = CStr(vValue) End Property Private Sub Form_Load() Dim lngOne As Long Dim vTargetKey As Variant Dim vCallingForm As Variant Dim vInstanceID As Variant If Not IsNull(Me.OpenArgs) Then lngOne = 1 vInstanceID = Trim(Nz(Left(Me.OpenArgs, InStr(lngOne, Me.OpenArgs, "^") - 1), "")) lngOne = InStr(lngOne, Me.OpenArgs, "^") + 1 vTargetKey = Trim(Nz(Mid(Me.OpenArgs, lngOne, InStr(lngOne, Me.OpenArgs, "^") - lngOne), "")) lngOne = InStr(lngOne, Me.OpenArgs, "^") vCallingForm = Trim(Nz(Right(Me.OpenArgs, Len(Me.OpenArgs) - lngOne), "")) Set ParentObject = Application.Forms(vCallingForm) lngExcursionID = CLng(Nz(vInstanceID, "0")) CallingName = vTargetKey ' A method to initialize the form End If ' If Not IsNull(Me.OpenArgs) Then -- Pictou "AndyWawa" wrote: > Hi, > I've got two forms (search and detail). Each form has an own class (events: > showing, saving etc.). The idea is to use a search form, having an output > (ID, Name etc.) I'd like to open the detail form using an ID from the search > form to show all record details. But how to pass to the detail form the > ID-parameter? > My detail form has a property ID, I want to set this property using the ID > value from the search form. But I can only use docmd.openform("xxx") and > there is no chace to pass the ID as a paramater. I don't want to use > something like that: docmd.openform("vv").recordsource = ID or something like > that. Is this possible? > Thanks for your help |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to open one form from the other form and close the first form | usenet | CSharp | 3 | 11-15-2007 06:37 PM |
| Open a form with a tab control to a specific page in access 2007 | usenet | ADO DAO RDO RDS | 1 | 10-06-2007 12:37 AM |
| Convert Microsoft Access form to PDF form | usenet | Adobe Acrobat | 4 | 01-13-2007 01:31 PM |
| vs2005 - Open a child form based on selected record parent form's dgv - how? | usenet | DOTNET | 2 | 12-19-2005 05:52 PM |
| required open ports for web based client access | usenet | Microsoft Exchange | 2 | 03-04-2004 11:22 AM |
All times are GMT -5. The time now is 08:26 AM.


