Using MS Access/Access database
Expert: Rob Henderson - 1/28/2005
QuestionI have a table called “tbl_DIN18273”. In the form, some data are entered to compare the values with the data in this table. If one or more items are out of requirement, then warning information will be given.
I wrote a procedure like below, when I run this command, computer does recognize the table “tbl_DIN18273”, Could you correct it for me? Thank you very much!
Private Sub Command106_Click()
If Si < [tbl_DIN18273]![Si_min] Or Si > [tbl_DIN18273]![Si_max] Then
MsgBox prompt:="Si is out of spec."
Else
If Fe < [tbl_DIN18273]![Fe_min] Or Fe > [tbl_DIN18273]![Fe_max] Then
MsgBox prompt:="Fe is out of spec."
Else
If Cu < [tbl_DIN18273]![Cu_min] Or Cu > [tbl_DIN18273]![Cu_max] Then
MsgBox prompt:="Cu is out of spec."
Else
If Mn < [tbl_DIN18273]![Mn_min] Or Mn > [tbl_DIN18273]![Mn_max] Then
MsgBox prompt:="Mn is out of spec."
Else
If Cr < [tbl_DIN18273]![Cr_min] Or Cr > [tbl_DIN18273]![Cr_max] Then
MsgBox prompt:="Cr is out of spec."
Else
If Zn < [tbl_DIN18273]![Zn_min] Or Zn > [tbl_DIN18273]![Zn_max] Then
MsgBox prompt:="Zn is out of spec."
Else
If Ti < [tbl_DIN18273]![Ti_min] Or Ti > [tbl_DIN18273]![Ti_max] Then
MsgBox prompt:="Ti is out of spec."
Else
If Mg < [tbl_DIN18273]![Mg_min] Or Mg > [tbl_DIN18273]![Mg_max] Then
MsgBox prompt:="Mg is out of spec."
Else
If Zr < [tbl_DIN18273]![Zr_min] Or Zr > [tbl_DIN18273]![Zr_max] Then
MsgBox prompt:="Zr is out of spec."
Else
If Ca < [tbl_DIN18273]![Ca_min] Or Ca > [tbl_DIN18273]![Ca_max] Then
MsgBox prompt:="Ca is out of spec."
Else
If Be < [tbl_DIN18273]![Be_min] Or Be > [tbl_DIN18273]![Be_max] Then
MsgBox prompt:="Be is out of spec."
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
AnswerHi
This is quite a complex statement and is difficult for me to debug.
If the error message is that the table is not recognised is that the name is wrong.
If this is not true, then a component of your statement is wrong.
Without you breaking it out I'm struggling to identify the problem.
rob