Search results

  1. nanscombe

    Syntax Error ( missing operator)

    I couldn't unzip the file but ... I did spot one error in the SQL ... If Me.txtCID.Tag & "" = "" Then CurrentDb.Execute "INSERT INTO COURSE (BranchID, Course, CourseDescription, CourseLimitations) " & _ "VALUES (" & Me.cboBranch & ",'" & Me.txtCourse & "', '" & Me.txtCourseDescription & "'," '...
  2. nanscombe

    Are you an atheist?

    The Earth is around 4,500,000,000 years old. Homo Sapiens have been around for about 200,000 years. So what was God doing for the other 4,499,800,000 years?
  3. nanscombe

    2014 Programmers Survey - What do you Drink During Work

    I suppose the days of the liquid lunch at a local pub on Fridays are long gone. :( An excellent networking / team building activity. :)
  4. nanscombe

    please help with time calculation

    I believe that the control source would be =Format(([txtTime2] - [txtTime1]), "HH:MM") If you wanted like XXX.Y Hrs you could try ... =(Datediff("n", [txtTime2], [txtTime1]) / 60) If that doesn't work you might need to wrap it in a function. Public Function diffInHH(byVal dihTimeEnd as...
  5. nanscombe

    Form with multi-criteria searches, uses strings and filters

    You're welcome. :) No compiler handy either, just plenty of experience of building SQL statements by hand. ;)
  6. nanscombe

    Form with multi-criteria searches, uses strings and filters

    Have a try with this ... Dim strSQL as String If Len(Me.Keyword & vbNullString) > 0 Then If Len(strSql & vbNullString) > 0 Then strSQL = strSQL & " AND " strSQL = strSQL & "([Item Description] Like '*" & Me.Keyword & "*')" End If If Len(Me.HRCombo & vbNullString) > 0 Then If...
  7. nanscombe

    Use parameter value to evaluate data

    If you are using the Query builder it sounds like you want to create three sets of criteria each on it's own line. Field Category Team Criteria "Sales" In(1,9,5) Criteria "Purchase" 7 Criteria Not In("Sales", "Purchase") In(1,9,5,7) The fields in a single line of criteria are...
  8. nanscombe

    auto generate filenumber based on number of records in that year

    That's Ok. I'm glad it works for you. :)
  9. nanscombe

    2014 Programmers Survey - What do you Drink During Work

    I don't know about fancy, as in coffee shop, but I remember a phase when I worked my way through the whole range of different Nescafé coffee types that I could find in my local grocery shop. They weren't Decaf varieties either. I also went through a phase of trying different Twinings teas as...
  10. nanscombe

    auto generate filenumber based on number of records in that year

    I have a configurable function that should achieve this for you. Rather than using DCount(), to count the records, it is based on DMax() so it looks at the largest existing value and increments it. Public Function nextIdString(ByVal nisFieldName As String, ByVal nisTableName As String, ByVal...
  11. nanscombe

    Can you use CASE and INSTR together ?

    [Post 3 of 3] 3) selectLike3() - Strings to be matched read from field phrase and results read from field result of tblMatchPhrases. Public Function selectLike3(ByVal Haystack As Variant, Optional ByVal doReset As Boolean = False) Static match3Array() As String, resultArray() As String...
  12. nanscombe

    Can you use CASE and INSTR together ?

    [Post 2 of 3] 2) selectLike2() - Strings to be matched read from field phrase of tblMatchPhrases and hardcoded results. Public Function selectLike2(ByVal Haystack As Variant, Optional ByVal doReset As Boolean = False) Static match2Array() As String, match2ArrayIndex As Long, blAlready2Loaded...
  13. nanscombe

    Can you use CASE and INSTR together ?

    I have put together a database with three increasingly complex functions: [Post 1 of 3] 1) selectLike1() - Hardcoded values for the strings to be matched. Public Function selectLike1(ByVal Haystack As Variant) Dim TM As String TM = "" If Len(Nz(Haystack)) = 0 Then Exit Function Select Case...
  14. nanscombe

    VBA code to insert a CR/LF in a memo field based on search string

    I first used the fingerprint idea when faced with getting info out of thousands of digital photos. Searching for strings like Canon and Casio was pretty straightforward, dates less so. You could see the datestamp info in the JPG files, via a Hex editor, it was a matter of figuring out a way of...
  15. nanscombe

    VBA code to insert a CR/LF in a memo field based on search string

    That's good to hear. Glad to help. :)
  16. nanscombe

    VBA code to insert a CR/LF in a memo field based on search string

    I remembered that you can't get zip files, hence unzipped Db :) Right, I've adjusted the code to deal with single hour digit and double hour digit by checking for both and picking the one closest to the beginning of the string, assuming they exist. The new function looks like this. Public...
  17. nanscombe

    Question dates and uniques

    Where people are relatively new to coding I tend to prefer writing a less efficient code with comments so they can understand what's happening.
  18. nanscombe

    Question dates and uniques

    I have attached a new version of the demo database. Now I better understand what's going on with the dates in VBA, courtesy of Allen Browne, and have had a chance to reconsider the logic here is an improved version of the function. Public Function checkForExistingBooking(ByVal cebRoomNo As...
  19. nanscombe

    Question dates and uniques

    I used chr(34) in this instance to make it clearer to read than using triple quotes (""") I used concatenation, in this case, because you can't mix line continuation and comments. Of course, not adding comments also saves typing but it doesn't help people to understand what is going on with...
  20. nanscombe

    Question dates and uniques

    Just been reading Allen Browne's article International Dates in Access strSQL = "SELECT * FROM tblDonation WHERE DonationDate > #" & Format(Me.StartDate, "mm\/dd\/yyyy") & "#;" That explains a lot, to create a SQL string with a date using #s it seems you've always got to convert it to...
Back
Top Bottom