I have a Form A where it displays the dates of the records based on Table A.
Then I have a Pop-up Form where I enter some details of the record. There is a textbox where I can enter the date of the record.
I am attempting to save the date entered from the Pop-up Form onto the Form A.
The initial code was
With the above code, Form A will show the date value that is entered on the Pop-up Form. Which is okay.
But when there is no value entered at the Pop-up Form, the Form A date also shows nothing.
I know, because I have set it to NULL when there is no value entered.
For your info, "txtDate.value = workdaysAdd([datDateIs], getKPI("Measurement", False))" means that when no date is entered, it will show a previous date which has been added by 4.
Which means when the previous date was 01.07.2017, it will show 05.07.2017.
That code works fine because I am using it on other forms.
The problem is, how do I show this added date into Form A?
I have tried editing the codes as shown below but it's not working.
Then I have a Pop-up Form where I enter some details of the record. There is a textbox where I can enter the date of the record.
I am attempting to save the date entered from the Pop-up Form onto the Form A.
The initial code was
Code:
If Not IsNull(txtDate.value) Then
If cboTaskType.Column(2) Like "Analyse*" Then
CurrentDb.Execute "UPDATE tblA SET datDate = #" & datConvert(txtDate.value) & "# WHERE xxx ;"
[B] ElseIf (txtDate.value = workdaysAdd([datDateIs], getKPI("Measurement", False))) Then
CurrentDb.Execute "UPDATE tblA SET datDate = NULL WHERE xxx;"
[/B]
Else
CurrentDb.Execute "UPDATE tblA SET datDate = #" & datConvert(txtDate.value) & "# WHERE xxx ;"
End If
End If
With the above code, Form A will show the date value that is entered on the Pop-up Form. Which is okay.
But when there is no value entered at the Pop-up Form, the Form A date also shows nothing.
I know, because I have set it to NULL when there is no value entered.
For your info, "txtDate.value = workdaysAdd([datDateIs], getKPI("Measurement", False))" means that when no date is entered, it will show a previous date which has been added by 4.
Which means when the previous date was 01.07.2017, it will show 05.07.2017.
That code works fine because I am using it on other forms.
The problem is, how do I show this added date into Form A?
I have tried editing the codes as shown below but it's not working.
Code:
If Not IsNull(txtDate.value) Then
[B]Dim datDateAuto As Date
datDateAuto = workdaysAdd([daDatetIs], getKPI("Measurement", False))[/B]
If cboTaskType.Column(2) Like "Analyse*" Then
CurrentDb.Execute "UPDATE tblA SET datDate = #" & datConvert(txtDate.value) & "# WHERE xxx ;"
ElseIf (txtDate.value = workdaysAdd([datDateIs], getKPI("Measurement", False))) Then
CurrentDb.Execute "UPDATE tblA SET datDate = [B]#" & datMessungAuto & "#[/B] WHERE xxx;"
Else
CurrentDb.Execute "UPDATE tblA SET datDate = #" & datConvert(txtDate.value) & "# WHERE xxx ;"
End If
End If