I'm still very new in this. I manage to figure this out by looking at previous threads regarding 2nd value.
I have a table called ReproductionT and I want a record where the WhelpingDate value is the 2nd highest.
I have an Unbound Textbox in a subform called PrevWhelpingDate.
This event runs from the subform PostPartumSubF.
Private Sub Form_Load()
DoCmd.SetWarnings True
DoCmd.RunSQL "SELECT Max(WhelpingDate) AS PrevWhelpingDate FROM ReproductionT WHERE "" " & _
"And MotherID = "" & MotherID AND WhelpingDate < (Select " & _
"Max(WhelpingDate) FROM ReproductionT)"
DoCmd.SetWarnings False
End Sub
I also have this in my main form:
Private Sub Form_Load()
PostPartumSubF.Requery
End Sub
Not sure if I have the right Event Procedures and how do I get the value to show in the textbox in the subform.
It doesn't show a value when I open the form.