Hi,
What I'm trying to do is when I enter a item number in my form (frmNewSpecs) I want a Form to Open (FrmOldSpecs) which has the last lot of specs for that item number which runs from a query (I can do this bit OK), then I want to copy these enteries to FrmNewSpecs. I can do this when there has been a previous entry but not when there hasn't. The code I'm using is:
Private Sub TPSEd_AfterUpdate()
Dim stDocName As String
stDocName = "FrmOldSpecs"
DoCmd.OpenForm stDocName, acNormal
If IsNull(Forms![FrmOldSpecs]![LastOfTest1]) = True Then
DoCmd.Close acForm, StDocName
Else
Me.Test1 = Forms![FrmOldSpecs]![LastOfTest1]
Me.Test2 = Forms![FrmOldspecs]![LastOfTest2]
Me.Test3 = Forms![FrmOldSpecs]![LastOfTest3]
DoCmd.Close acForm, StDocName
End If
End Sub
When there is no data it keeps saying that the value isn't valid for this field and highlights the Me.Test1=... line. If there is no data I want the FrmOldSpecs to close and the code to stop running so I can make the enteries manually on the FrmNewSpecs
Where am I going wrong?
Rob! [Bigcheeks]
Process and Procedure are the last hiding place of people without the wit
and wisdom to do their job properly.
What I'm trying to do is when I enter a item number in my form (frmNewSpecs) I want a Form to Open (FrmOldSpecs) which has the last lot of specs for that item number which runs from a query (I can do this bit OK), then I want to copy these enteries to FrmNewSpecs. I can do this when there has been a previous entry but not when there hasn't. The code I'm using is:
Private Sub TPSEd_AfterUpdate()
Dim stDocName As String
stDocName = "FrmOldSpecs"
DoCmd.OpenForm stDocName, acNormal
If IsNull(Forms![FrmOldSpecs]![LastOfTest1]) = True Then
DoCmd.Close acForm, StDocName
Else
Me.Test1 = Forms![FrmOldSpecs]![LastOfTest1]
Me.Test2 = Forms![FrmOldspecs]![LastOfTest2]
Me.Test3 = Forms![FrmOldSpecs]![LastOfTest3]
DoCmd.Close acForm, StDocName
End If
End Sub
When there is no data it keeps saying that the value isn't valid for this field and highlights the Me.Test1=... line. If there is no data I want the FrmOldSpecs to close and the code to stop running so I can make the enteries manually on the FrmNewSpecs
Where am I going wrong?
Rob! [Bigcheeks]
Process and Procedure are the last hiding place of people without the wit
and wisdom to do their job properly.