Help needed linking forms together.

MattCollins

Registered User.
Local time
Today, 08:45
Joined
Aug 12, 2005
Messages
49
I have two forms, a main form frmProperty and a secondary form "Training Details" you access the training details via a button on the frmProperty form. This is the code for the button.


Private Sub Trainingbtn_Click()
On Error GoTo Err_Trainingbtn_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Training Details"

stLinkCriteria = "[Property Code]=" & Me![PropertyCode]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Trainingbtn_Click:
Exit Sub

Err_Trainingbtn_Click:
MsgBox Err.Description
Resume Exit_Trainingbtn_Click

End Sub


I noticed however that whenever the user enters data no matter what the "PropertCode" of the main form it was assigning it to PropertyCode = 0 :(

So as a temp fix i have inserted the following code into the GotFocus of a text box that is filled in. This code did not help in the Form_Load section...

[Form_Training Details].[Property Code] = Form_Property.[PropertyCode]

This works, but obviously is very messy. Where am i going wrong???
 
Is the properycode a numerical field or a text field?


Text: "properycode = '" & Me!properycode & "'")
 
Its a numerical field
 

Users who are viewing this thread

Back
Top Bottom