Seek Metodo and dlookup

F

Frank Lara

I have 2 Case and the first only search the date and I need to found "School
and Date" on the second case I use dlookup() and If I have the Date for other
school display me exist this information but this school don't have record
for this date.
Please help me I have 3 weeks with this problem. appreciate your help.

this is the codes.
------------
Seek Method

Set db = DBEngine.Workspaces(0).Databases(0)
Set TB = db.OpenRecordset("schools")
Set tb1 = db.OpenRecordset("BreakLunchSnack")
Set tb2 = db.OpenRecordset("Provisiona")
Me!School = Me![Combo27].Column(0)


tb1.MoveFirst
With tb1
.Index = "Date"
esvar = .Bookmark
.Seek "=", [Date]

If .NoMatch Then
Else
MsgBox ("This Date found and You are need to verification date")
'Date.SetFocus
End If
tb1.Close
End With
Else
End If
------------------------
dlookup

Dim icount, ecount
'check to see if this is a duplicate value before updating
icount = DLookup("[School]", "[breaklunchsnack]", "[School] =
Form.[School]") & "," & DLookup("[date]", "[breaklunchsnack]", "[date] =
Form.[date]")
ecount = Me!School & "," & Me!Date

MsgBox (Forms!breaklunchsnack!School)
MsgBox ("yo soy " + icount)
MsgBox ("yo soy ecount " + ecount)
MsgBox (RecNum)
If icount = ecount Then
' this item has already been selected
MsgBox "You have already selected this item."
Cancel = True
Undo
Else
msgBox "the school and date Not Exist"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top