E
Edward Letendre
I have the following code that was created before I started on this project:
Option Compare Database 'Use database order for string comparisons
Function CalcKm()
Dim db As Database
Dim FormName As String, SubFormName
Dim eol As Single, bol As Single
Dim statint As Single, kmcount As Single
Dim getval As Variant
Dim fm As String
Dim yearstr As String
Dim Yearval As Integer
Set db = DBEngine.Workspaces(0).Databases(0)
FormName = Screen.ActiveForm.Name
getval = Forms(FormName)![Year]
If IsEmpty(getval) Or IsNull(getval) Then
MsgBox "No Year!", 48, ""
Exit Function
Else
yearstr = getval
End If
Yearval = Val(yearstr)
Select Case Yearval
Case 95: SubFormName = "ATS LINES 1995"
Case 96: SubFormName = "ATS LINES 1996"
Case 97: SubFormName = "ATS LINES 1997"
Case 98: SubFormName = "ATS LINES 1998"
Case 99: SubFormName = "ATS LINES 1999"
Case 2000: SubFormName = "ATS LINES 2000"
Case 2001: SubFormName = "ATS LINES 2001"
Case 2002: SubFormName = "ATS LINES 2002"
Case 2003: SubFormName = "ATS LINES 2003"
Case 2004: SubFormName = "ATS LINES 2004"
Case 2005: SubFormName = "ATS LINES 2005"
Case 2006: SubFormName = "ATS LINES 2006"
End Select
'MsgBox FormName, 48, ""
getval = Forms(FormName).Form![DoCalc]
If IsEmpty(getval) Or IsNull(getval) Or getval = "N" Then
' MsgBox "No End of Line!", 48, ""
Exit Function
End If
getval = Forms(FormName)(SubFormName).Form![End of Line]
If IsEmpty(getval) Or IsNull(getval) Then
' MsgBox "No End of Line!", 48, ""
Exit Function
Else
eol = getval
' MsgBox Str$(eol), 48, ""
End If
on the line getval = Forms(FormName)(SubFormName).Form![End of Line] I get
the following error message:
Run Time Error 2465 Access cannot find the field 'ATS LINES 2006' referred
to in your expressions.
I have created all of the forms, tables and queries associated with the year
2006, but the weird thing is that this program ran before with 2005 tables,
forms, queries, etc. I have simply copied and renamed and added all the 2006
info I could think of. If someone could explain to me why this program ran
before I made the changes and or something I might have missed, I would
appreciate it.
Edward Letendre.
Option Compare Database 'Use database order for string comparisons
Function CalcKm()
Dim db As Database
Dim FormName As String, SubFormName
Dim eol As Single, bol As Single
Dim statint As Single, kmcount As Single
Dim getval As Variant
Dim fm As String
Dim yearstr As String
Dim Yearval As Integer
Set db = DBEngine.Workspaces(0).Databases(0)
FormName = Screen.ActiveForm.Name
getval = Forms(FormName)![Year]
If IsEmpty(getval) Or IsNull(getval) Then
MsgBox "No Year!", 48, ""
Exit Function
Else
yearstr = getval
End If
Yearval = Val(yearstr)
Select Case Yearval
Case 95: SubFormName = "ATS LINES 1995"
Case 96: SubFormName = "ATS LINES 1996"
Case 97: SubFormName = "ATS LINES 1997"
Case 98: SubFormName = "ATS LINES 1998"
Case 99: SubFormName = "ATS LINES 1999"
Case 2000: SubFormName = "ATS LINES 2000"
Case 2001: SubFormName = "ATS LINES 2001"
Case 2002: SubFormName = "ATS LINES 2002"
Case 2003: SubFormName = "ATS LINES 2003"
Case 2004: SubFormName = "ATS LINES 2004"
Case 2005: SubFormName = "ATS LINES 2005"
Case 2006: SubFormName = "ATS LINES 2006"
End Select
'MsgBox FormName, 48, ""
getval = Forms(FormName).Form![DoCalc]
If IsEmpty(getval) Or IsNull(getval) Or getval = "N" Then
' MsgBox "No End of Line!", 48, ""
Exit Function
End If
getval = Forms(FormName)(SubFormName).Form![End of Line]
If IsEmpty(getval) Or IsNull(getval) Then
' MsgBox "No End of Line!", 48, ""
Exit Function
Else
eol = getval
' MsgBox Str$(eol), 48, ""
End If
on the line getval = Forms(FormName)(SubFormName).Form![End of Line] I get
the following error message:
Run Time Error 2465 Access cannot find the field 'ATS LINES 2006' referred
to in your expressions.
I have created all of the forms, tables and queries associated with the year
2006, but the weird thing is that this program ran before with 2005 tables,
forms, queries, etc. I have simply copied and renamed and added all the 2006
info I could think of. If someone could explain to me why this program ran
before I made the changes and or something I might have missed, I would
appreciate it.
Edward Letendre.