dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

DLOOKUP Run-Time error 2001 'You cancelled the previous operation' - ms-access

This is a discussion on DLOOKUP Run-Time error 2001 'You cancelled the previous operation' - ms-access ; Can someone tell me what's wrong with this simple piece of code? Private Sub Command0_Click() Dim fanswer As String Dim fMonth As String Dim fYEAR As String Dim billc As Double fMonth = DatePart("m", DTPicker1) fYEAR = Right(DTPicker1, 2) If ...


Home > Database Forum > Other Databases > ms-access > DLOOKUP Run-Time error 2001 'You cancelled the previous operation'

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 04-28-2009, 10:05 AM
Database Newbie
 
Join Date: Apr 2009
Posts: 1
MABRUNA62 is on a distinguished road
Question DLOOKUP Run-Time error 2001 'You cancelled the previous operation'

Can someone tell me what's wrong with this simple piece of code?

Private Sub Command0_Click()
Dim fanswer As String
Dim fMonth As String
Dim fYEAR As String
Dim billc As Double


fMonth = DatePart("m", DTPicker1)
fYEAR = Right(DTPicker1, 2)

If Len(fMonth) = 1 Then
fMonth = "0" + fMonth
End If


fanswer = Nz(DLookup("[B_FiscalYr]", "Budget", _
"[CustomerID] = '" & fMonth & "' and [B_Year] = '" & fYEAR & "' and [B_Billing_Code] = " & billc), "N/A")

MsgBox fYEAR
MsgBox fMonth
MsgBox billc


If fanswer = "N/A" Then
fMonth = ""
fYEAR = ""
MsgBox " Fiscal Year Not Available"
DoCmd.GoToControl "DTPicker1"
End If
PFiscal = Nz(fanswer, "00-00")
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 02:34 AM.