Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to show a date record in a form

Status
Not open for further replies.

andytheit

IS-IT--Management
Dec 23, 2005
9
GB
I have a database (Access 2003) of vehicles and i need to query when an MOT is due. I Wanted it to open a form and show the MOT date 10 days before the MOT is due. This is what i have so far. I keep getting the error that it can't find the form - Forms!FMotDueDate!MOTDate

I would be very grateful of any help.

Thanks

Andy

Private Sub Command0_Click()
Dim vehicle As Database
Set vehicle = CurrentDb
Dim MOT As Date
MOT = Date + 10

If Forms!FMotDueDate!MOTDate = MOT Then
DoCmd.OpenForm "FMotDueDate"
Forms!FMotDueDate!MOTDate.SetFocus
Else
Mgs = "NO MOT'S ARE DUE"
Style = vbOKOnly + vbDefaultButton1

End If
End Sub
 
This is probably more a forms question (forum702)?

You seem to be trying to access a control on that form before opening it.

If you need to check whether it is open, you could try

[tt]If CurrentProject.AllForms("FMotDueDate").IsLoaded Then[/tt]



Roy-Vidar
 
Thanks i have changed it so the form is open first, so simple really. It still does not work so i have posted it in the other forum

Many Thanks

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top