S
SHIPP
I am having problems with Dlookup. I am using Access 97. A
copy of the code follows:
Option Compare Database
Option Explicit
Private Sub btnRun_Click()
On Error GoTo Err_btnRun_Click
Dim dtBeg As Date
' This one works
' dtBeg = DLookup("gl_perod_stdt", "ingres_gl_Perod_tbl",
' "gl_perod_year = " & Forms!rmSafewayScorecard.intYear)
' This one works
' dtBeg = DLookup("gl_perod_stdt", "ingres_gl_Perod_tbl",
' "gl_perod_id = " & Forms!rmSafewayScorecard.intPeriod)
' This one does not work.
dtBeg = DLookup("gl_perod_stdt", "ingres_gl_Perod_tbl", _
"gl_perod_year = " & Forms!frmSafewayScorecard.intYear
And "gl_perod_id = " & Forms!frmSafewayScorecard.intPeriod)
Me.dtBegDate = dtBeg
Exit_btnRun_Click:
Exit Sub
Err_btnRun_Click:
MsgBox Err.DESCRIPTION
Resume Exit_btnRun_Click
End Sub
The minute I try and put an AND in the criteria it tells
me I have a type mismatch. Individually the gl_perod_year
and gl_perod_id work. Any help would be greatly
appreciated. Thanks in advance.
copy of the code follows:
Option Compare Database
Option Explicit
Private Sub btnRun_Click()
On Error GoTo Err_btnRun_Click
Dim dtBeg As Date
' This one works
' dtBeg = DLookup("gl_perod_stdt", "ingres_gl_Perod_tbl",
' "gl_perod_year = " & Forms!rmSafewayScorecard.intYear)
' This one works
' dtBeg = DLookup("gl_perod_stdt", "ingres_gl_Perod_tbl",
' "gl_perod_id = " & Forms!rmSafewayScorecard.intPeriod)
' This one does not work.
dtBeg = DLookup("gl_perod_stdt", "ingres_gl_Perod_tbl", _
"gl_perod_year = " & Forms!frmSafewayScorecard.intYear
And "gl_perod_id = " & Forms!frmSafewayScorecard.intPeriod)
Me.dtBegDate = dtBeg
Exit_btnRun_Click:
Exit Sub
Err_btnRun_Click:
MsgBox Err.DESCRIPTION
Resume Exit_btnRun_Click
End Sub
The minute I try and put an AND in the criteria it tells
me I have a type mismatch. Individually the gl_perod_year
and gl_perod_id work. Any help would be greatly
appreciated. Thanks in advance.