PDA

View Full Version : Is it possible to search for records based on Names



wedd
02-01-2012, 11:28 PM
Hi experts, this question is in 2 parts. I created a text box on a form where the users would enter a customerID number and it would automatically display a customer's records based on visual basic code. However, it was brought to my attention the other day that the users may not always remember a specific customer ID for every customer, especially if there are hundreds or even thousands of customers. Is there an easier way were the customer can enter both the customer's first name and surname together and their particular records are displayed on the form using visual basic?


Part 2. I've also created the options for the user to choose dates and times of when to schedule a booking. However, to avoid any issues of booking a customer at te same time on the same date, I would like a message box that reads the dates and times and pops up a message box that the times and dates have already been booked by another customer on the same form. It may be straight forward for experts like you...but I'm a basic/intermediate coder of vba in access so this will be a great learning curve for me...

Thanks for your contributions:friends:

Movian
02-06-2012, 12:55 PM
This could be done with SQL

somthing akin to

dim myrs as new adodb.recordset
myrs.open "SELECT * FROM table WHERE Field1 like 'text' and field2 like 'text'"
'Do stuff here
myrs.close
set myrs = nothing


you can use the same type of SQL statement to open up a recordset based on dates...

then use a messagebox to display text

msgbox "your text would go here"