hello! Im having trouble with the Date and Time fields in my db. I have a BeginDate and EndDate and BeginTime and EndTime fields indicating the working hours of hotels.
1] The first thing is: can i use ONLY day and month (for the date fields)? I have tried everything but i think Access absolutely requires the use of years (which is irrelavant for the business periods of hotels). If yes, please tell me the mask/format (or any other indirect way you can think of) as i have tried everything...
2] Secondly, how can i search (in my SearchForm) for a hotel based on a date or time range or a specific date/time? Any ideas about the code (im brand new to Access, and such code examples do not appear in my Access books). Any links to such online available code that could help?
Here's my SearchForm's code (eg. Searching for Company Name and Area - unbound text boxes...) to get an idea/in case you need it:
Private Sub cmdSearch_Click()
Dim sql As String
sql = "SELECT Company.CID, CompanyName, Area, DID, DepartmentName FROM QRY_Departments WHERE 1=1 "
If Me.txt_CompanyName.Value <> "" Then
sql = sql & " AND CompanyName LIKE '" & Me.txt_CompanyName.Value & "*'"
End If
If Me.txt_Area.Value <> "" Then
sql = sql & " AND Area LIKE '" & Me.txt_Area.Value & "*'"
...
Me.lst_Results.RowSource = sql
Me.lst_Results.Requery...
Thank you in advance for any help!!! (sorry for the long thread...)
Vas
1] The first thing is: can i use ONLY day and month (for the date fields)? I have tried everything but i think Access absolutely requires the use of years (which is irrelavant for the business periods of hotels). If yes, please tell me the mask/format (or any other indirect way you can think of) as i have tried everything...
2] Secondly, how can i search (in my SearchForm) for a hotel based on a date or time range or a specific date/time? Any ideas about the code (im brand new to Access, and such code examples do not appear in my Access books). Any links to such online available code that could help?
Here's my SearchForm's code (eg. Searching for Company Name and Area - unbound text boxes...) to get an idea/in case you need it:
Private Sub cmdSearch_Click()
Dim sql As String
sql = "SELECT Company.CID, CompanyName, Area, DID, DepartmentName FROM QRY_Departments WHERE 1=1 "
If Me.txt_CompanyName.Value <> "" Then
sql = sql & " AND CompanyName LIKE '" & Me.txt_CompanyName.Value & "*'"
End If
If Me.txt_Area.Value <> "" Then
sql = sql & " AND Area LIKE '" & Me.txt_Area.Value & "*'"
...
Me.lst_Results.RowSource = sql
Me.lst_Results.Requery...
Thank you in advance for any help!!! (sorry for the long thread...)
Vas