Hello all,
I am tearing my hair out!! - and I dont have a lot now!
I am trying simply to open a form either in Add or Read mode (in which case I want the last record entered) depending on a variable like OpenVar equalling 1 or -1 and whatever I try it always opens in Add mode. What am I doing wrong??
OpenVar is a global.
This is my code:
Am I using the GoToRecord in the wrong context perhaps?
Hope you boys can help before I am completely bald!
Inky
A fool and his money are soon parted - so you might as well send it to me!
I am tearing my hair out!! - and I dont have a lot now!
I am trying simply to open a form either in Add or Read mode (in which case I want the last record entered) depending on a variable like OpenVar equalling 1 or -1 and whatever I try it always opens in Add mode. What am I doing wrong??
OpenVar is a global.
This is my code:
Code:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FRMDayPlanner"
If OpenVar = 1 Then 'Dates are equal
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria
DoCmd.GoToRecord , , acLast
ElseIf OpenVar = -1 Then 'Dates not equal
DoCmd.OpenForm stDocName, , , , acFormAdd
End If
Am I using the GoToRecord in the wrong context perhaps?
Hope you boys can help before I am completely bald!
Inky
A fool and his money are soon parted - so you might as well send it to me!