Search results

  1. nanscombe

    manage items in a list box

    If you just needed to collect the data, rather than display it, you could have used an Array.
  2. nanscombe

    Less then or greater value is not working

    Anything more than, or equal to +/- 100,000 If ABS(Me.Variance_From_Budget >= 100000) Then Anything more than +/- 99,999 If ABS(Me.Variance_From_Budget > 99999) Then
  3. nanscombe

    Less then or greater value is not working

    So if you want to trap the variance when it is >= (+/-) 100,000 it sounds like the following would do you ... If ABS(Me.Variance_From_Budget >= 100000) Then
  4. nanscombe

    Less then or greater value is not working

    If (Me.Variance_From_Budget < 99999 And Me.Variance_From_Budget >= -99999) The statement will only be True if Me.Variance_From_Budget is between -99999 and 99998. Do you want the opposite, i.e. True if Me.Variance_From_Budget is less than -99999 or Greater than 99998? If...
  5. nanscombe

    tab using control tabindex

    That's odd because I just tried using SendKeys "{TAB}" on my PC, running Windows 7 and Access 2010, and it moved the cursor to the next field. ETA: Doing a bit of reading it would appear to be something to do with UAC (User Account Control) it could turn out to be an intermittent problem...
  6. nanscombe

    If Then Statement

    I see no obvious reason why your code above should not work, in fact I have attatched a demo showing that i does work. :confused: The only change I would make personally is to the form closing line, I would use ... DoCmd.Close acForm, Me.Name, acSaveNo Me.Name is a shortcut to the name of...
  7. nanscombe

    Keep Preceding 0 in VBA

    Indeed, That's what I was achieving in the piece bit of code in Post 16. Public Function sixMonthsAgo(ByVal theDate As Long) Dim varTemp As Variant ' Create a temporary date in MM-DD-YYYY format, based on the Year and Month passed in. ' I added a Day of 14 so Access won't mistake it for a...
  8. nanscombe

    Keep Preceding 0 in VBA

    The numbers that the OP mentioned, back in post 5, don't appear to be dates rather a numerical expression of YYYYMM. I had previously come up with an IIF version of the expression. IIF(Right(DMax("[MyField]", "[MyTable]"), 2) < "06", DMax("[MyField]", "[MyTable]") - 95, DMax("[MyField]"...
  9. nanscombe

    Keep Preceding 0 in VBA

    Yes, having possibly answered the posters query by suggesting the placement of quotes around the 06 ("06") in Post 9, I was also trying to come up with a more generic solution. Not having used DateSerial() before, I was using CDate() and DateAdd() to perform the same task. Your use of...
  10. nanscombe

    Keep Preceding 0 in VBA

    That's all right, namliam probably thinks I just pinched "his" idea and overcomplicated it (again). However I am an iterative thinker and go through several versions of code before the final one. My first attempt, which I deleted as it was slightly more complicated was ... Public Function...
  11. nanscombe

    Keep Preceding 0 in VBA

    The above function could probably be reduced to a few lines of code. Dim varTemp As Variant varTemp = DMax("[MyField]", "[MyTable]") varTemp = DateSerial(Val(Left(varTemp, 4)), Val(Right(varTemp, 2)) - 6, 1) varTemp = Val(Format(varTemp, "YYYYMM")) Or even a single line, if required...
  12. nanscombe

    Keep Preceding 0 in VBA

    However if one was passing in a number like 201401 would it be treated like a date? ETA: Yes, it would. Here is a function based on namliam's idea method of using DateSerial that returns the result as a Long Integer Public Function sixMonthsAgo(ByVal smaDate As Long) Dim varTemp As Variant...
  13. nanscombe

    Keep Preceding 0 in VBA

    You probably just need to enclose the 06 in quotes to make it a string. If Right(DMax("[MyField]", "[MyTable]"), 2) < "06" Then
  14. nanscombe

    disable / lock fields on form & subform based on checkbox

    Since the value of the properties is always the opposite of the value of the Locked control you could probably tidy the code up a little ... Private Sub Form_Current() Dim blAllowChanges as Boolean ' Assume a default of True for the checkbox "Locked" if it is Null blAllowChanges = NOT...
  15. nanscombe

    If Then Statement

    The acSaveYes parameter of the DoCmd.Close method saves any changes to the layout of the form rather than the data. Any new record entered would automatically be saved when the form closed. I think there is more to this than meets the eye. If they answer no: How would they verify the...
  16. nanscombe

    Royal Family

    But there was this thing called the English Civil War when parliament beat the Royals, executed the King and took all their land away. A few years later parliament gave it all back to them. So the reason that the "Royal Family" has land is because parliament handed it back.
  17. nanscombe

    Updating multiple records on a screen

    It's difficult to help further without knowing what you actually have. Anyhow, just out of interest here's one way I would tackle the idea of having lots of records and only editing a single record at a time. In the example, form frmMaintainPeople_v1, I have used a Listbox to display multiple...
  18. nanscombe

    Between "AA-*" And "ZZ-*"

    Oh darn! Talk about looking but not seeing. Since when have we ever used a wild card with a BETWEEN statement? :banghead:
  19. nanscombe

    Between "AA-*" And "ZZ-*"

    I'm glad it worked. Just trying to keep it simple .. :) Funny thing is that I might have tried a custom function solution before hanging around with the other guys from here for a while. ;)
  20. nanscombe

    Between "AA-*" And "ZZ-*"

    So it wouldn't work if you said ... HAVING (([3rd Item Number] BETWEEN "AA*" AND "ZZ*") AND (Mid([3rd Item Number], 3, 1) ="-"))
Back
Top Bottom