I'm a beginner in MS Access and this is my problem;).
Here is the code (VBA) associated to an event on a click on the combobox where I call the query named LastVisit :
Private Sub CasellaCombinata0_Click()
Dim Variable1 As Date
Variable1 = DLookup("reservationdate", "LastVisit")
Me.DisSelected.Caption = "The last visit was: " & Variable1
End Sub
Here is the code (sql) of the query "LastVisit":
SELECT Max(reservation_date) AS reservationdate
FROM Appointment
WHERE (((Appointment.ID_SP) = TempVars!TempID)
And ((Appointment.ID_patient) = Forms![levisite].[CasellaCombinata0]));
I don't know if the last notation is correct: Forms.[levisite].[CasellaCombinata0]
. I get this error:
Run-time error "2450" Application cannot find form '"levisite".
But when I run it directly to the subform it works and I don't know where is the problem. Thanks for the attention!
The right answer is the following notation:
Forms.NavigationBar.Subcontrolname.Form.Comboxname
So in my case it was:
Forms.Home.SottomascheraSpostamento.Form.CasellaCombinata0
The subcontrol is not the name of the subform but it's where the subform resides.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.