I have an Access 2003 database that is acting pretty strangely. The controls on the form are all unbound and I am using DAO to reference the tables / queries. I have a date field on the form that when clicked will open an ActiveX calendar control. When the date is selected on the calendar, it puts the date into the text box. I then hide the calendar. I need to set the focus to another field before hiding the calendar. My code use to work! Now, I get the Runtime Error '2465' can't find field.... error. The problem is when I choose to debug and just hit the continue button, the code runs fine. Also, the first time I run the code it runs fine. My code is as follows:
I am not using any special characters and the code will run once I push continue. Any suggestions?????
Code:
Private Sub TxtDevice_Warranty_Expire_GotFocus()
TxtDevice_Warranty_Expire.SelStart = 0
TxtDevice_Warranty_Expire.SelLength = Len(TxtDevice_Warranty_Expire.Text)
lngCalID = 8
Me.CalPurchase_Detail_Dates.Visible = True
End Sub
Code:
Private Sub CalPurchase_Detail_Dates_Click()
If lngCalID = 4 Then
Me.TxtDate_of_Purchase.Value = Me.CalPurchase_Detail_Dates.Value
Me.TxtQuantity_Price.SetFocus
ElseIf lngCalID = 5 Then
Me.TxtSoftware_License_Expiration.Value = Me.CalPurchase_Detail_Dates.Value
Me.CmdSavePurchaseDetail.SetFocus
'ElseIf lngCalID = 6 Then
' Me.TxtHardware_Warrenty_Expire.Value = Me.CalPurchase_Detail_Dates.Value
' Me.CmdSavePurchaseDetail.SetFocus
ElseIf lngCalID = 7 Then
Me.TxtMaintenance_Support_Expire.Value = Me.CalPurchase_Detail_Dates.Value
Me.TxtMaintenance_Support_Level.SetFocus
ElseIf lngCalID = 8 Then
Me.TxtDevice_Warranty_Expire.Value = Me.CalPurchase_Detail_Dates.Value
Me.CmdSavePurchaseDetail.SetFocus
End If
Me.CalPurchase_Detail_Dates.Visible = False
End Sub