How do I find a record in access with multiple criteria using VB?

hydeyho

Registered User.
Local time
Today, 00:02
Joined
Mar 1, 2007
Messages
31
I've got a form called frmBooking that I want to search (proabably using DoCmd.FindRecord). It has 2 fields, 1 for employee id and 1 for course id (and a third which is the booking id).

I'm using employee id and course id to create a booking record (to book them on a course) so I want to search the bookings already made to see if the person is already booked on the course. Is there anyway to do this in VB?
 
Oh, and it would be preferable if I could get a return that is True or False if possible.
 
Anyone? I can't seem to find anyway to return a true oe false value
 
embed your code in a function if booking successful return true or if false return false

declare a return value for your function as a boolean then assign the function name to true or false

e.g.
public Function PlaceBooking(your parameters) as Boolean
PlaceBooking=true
end Function
 
embed your code in a function if booking successful return true or if false return false

declare a return value for your function as a boolean then assign the function name to true or false

e.g.
public Function PlaceBooking(your parameters) as Boolean
PlaceBooking=true
end Function

I think I know where you are going with this but how do I check each record from start to finish? I pressume I need something along the line of:

While not at end of records
DoCmd.GoToControl "intEmployee"
If intEmployee = Parameter1 then
DoCmd.GoToControl "intCourse"
If intCourse = Parameter2
Exists = True

End If​
End If

DoCmd.NextRecord​

End while

Is there any sample code anywhere for checking the entire record set?
 
Try to do this with DCount function.
 

Users who are viewing this thread

Back
Top Bottom