linking a form ID across a middle form to another form

Makaveli

Access SMP
Local time
Today, 13:29
Joined
Jul 1, 2008
Messages
17
Hi,

I've asked this question before but to save time i never went into enough detail and therefore never got the right answer. I can not use subforms because there would be much to much data on the screen.

my first table properties has a form to input all of the data.
my second table purchaser has 3 forms to input-edit-search for data.

on the form properties theres a button called purchaser, once you click this button i have another form called purchaser options. they're add-edit-search, this opens the purchaser forms in these specific modes.

the properties and purchaser table are linked via property id which is an autonumber.

my problem is that the purchaser forms should automaticaly know which property its updating, by carrying the property id across in some way or another.

I have several forms to do this for as theres also,

vendor
broker
solicitor
affiliate
charge
morgage
valuation
broker company
solicitor company
etc

i've tried using the code below which i found somewhere on the forum but it only seems to work to link one form directly from another form. As i use a middle form it seems to fold.




Option Compare Database
Option Explicit
Public formOpen As Variant
Function IsLoaded(strFrmName As String) As Boolean

' Determines if a form is loaded.

Const conFormDesign = 0
Dim intX As Integer

IsLoaded = False
For intX = 0 To Forms.Count - 1
If Forms(intX).FormName = strFrmName Then
If Forms(intX).CurrentView <> conFormDesign Then
IsLoaded = True
Exit Function ' Quit function once form has been found.
End If
End If
Next
End Function




Private Sub Form_beforeUpdate(Cancel As Integer)
Me.[Property ID] = Forms![property]![Property ID]
End Sub



I'm sure this isn't all of the code that i was using, i think i may have lost some of it, but its to give you a basic idea. because theres that many forms linking to the one, even if i used a few subforms the data alone off the properties table fills the screen, and it would confuse the users.

this code is still handy though as it closes the purchaser form if the propertys form is closed so that the user cant mess it up via adding purchasers to a property that doesnt exist

please help :)
 
#1 Please use code tags, makes code much more readable:
Code:
Option Compare Database
Option Explicit
Public formOpen As Variant
 Function IsLoaded(strFrmName As String) As Boolean
    
    '  Determines if a form is loaded.
    
    Const conFormDesign = 0
    Dim intX As Integer
    
    IsLoaded = False
    For intX = 0 To Forms.Count - 1
        If Forms(intX).FormName = strFrmName Then
            If Forms(intX).CurrentView <> conFormDesign Then
                IsLoaded = True
                Exit Function  ' Quit function once form has been found.
            End If
        End If
    Next
End Function

 
 
 
Private Sub Form_beforeUpdate(Cancel As Integer)
Me.[Property ID] = Forms![property]![Property ID]
End Sub

This code doesnt do anything pertaining to linking forms tho... You can link forms using the DoCmd.Openform command then using EITHER the Where, Filter or OpenArgs arguments to pass "stuff" like PKs and other needed information from form to form....

I hope this helps, or as more questions/provide the "failing" code.

Good Luck
 

Users who are viewing this thread

Back
Top Bottom