Search results

  1. G

    Calculating the information for a text field on a form from a query

    The date before. It may sound strange but I'm looking for the period of time between when last on holiday and the thing being resourced. It's a fair point though because when I go to do the same thing with End_Date I probably will want to recognise that the event being booked is actually a...
  2. G

    Calculating the information for a text field on a form from a query

    Done and I do get a message box containing the date of the last holiday:D
  3. G

    Calculating the information for a text field on a form from a query

    Ok so here's where I'm at... I re-wrote my code:Function LastHol() Dim startdate As Date startdate = Forms!Resourcing!Start_Date If Forms!Resourcing!Trainer_Name = Null Then Exit Function If Not IsNull(Forms!Resourcing!Trainer_Name) Then MsgBox DLookup("[Start_Date]", "Hours Holiday_P1"...
  4. G

    Calculating the information for a text field on a form from a query

    Doh! That does raise another issue though. Sometimes there will be no value in the trainer box as it's possible to schedule an event before you know who will deliver it. Guess I'm need and If and elseIf statement now as well. Hmmmm
  5. G

    Calculating the information for a text field on a form from a query

    I have absolutely no idea and even less idea why when I use the second code it doesn't just stop at the same error. If it's working through each line of code sequentially then it shouldn't be able to get past it and highLight Me on the next line :banghead:
  6. G

    Calculating the information for a text field on a form from a query

    Not working With the first I get invalid use of Null and again it highlights the line above the code that you sent tName = Forms!Resourcing!Trainer_Name With the second I get compile error, Invalid use of the Me Keyword and it highlights the Me at Trainer_Name in red below Msgbox...
  7. G

    Calculating the information for a text field on a form from a query

    Ok you're forgetting who it is you're dealing with here. Am I creating a new function called MsgBox() or am I pasting the code into the function I've already posted? Can you paste the full code that you want me to test please?
  8. G

    Calculating the information for a text field on a form from a query

    Ok thanks for the tip about name. I've replaced each incidence of the with tName so the code now looks like:Function LastHol() Dim startdate As Date Dim tName As String startdate = Forms!Resourcing!Start_Date tName = Forms!Resourcing!Trainer_Name Forms!Resourcing!Last_Hol =...
  9. G

    Calculating the information for a text field on a form from a query

    Does this look any better? Forms!Resourcing!Last_Hol = DLookup("[Start_Date]", "Hours Holiday_P1", "'[Trainer_Name]'" = Name And "[Start_Date]" < startdate) The debugger still kicks in even before it gets to that line of the code. The debgger says invalid use of null and when I debug...
  10. G

    Calculating the information for a text field on a form from a query

    Before I read your last post I managed to compile the database by changing my code to this: Function LastHol() Dim startdate As Date Dim Name As String startdate = Forms!Resourcing!Start_Date Name = Forms!Resourcing!Trainer_Name Forms!Resourcing!Last_Hol = DLookup("[Start_Date]", "Hours...
  11. G

    Calculating the information for a text field on a form from a query

    Help Ok so I thought I would try to just return the date of the last holidaytaken prior to the start date entered on my form before I started calculating date differences etc. I added an unbound text box to my table called Last_Hol I tried creating a module with this code Function...
  12. G

    Calculating the information for a text field on a form from a query

    Sorry Got so busy with my rant that I forgot to say thank you:) Thank you
  13. G

    Calculating the information for a text field on a form from a query

    Last post till tomorrow Unique ID is generated by access and exists nowhere else. The unique employee ID is generated by our company (I could have made this the primary key but didn't). I'll examine the link in the morning. As for Access. I see so many complex excel files that fall...
  14. G

    Calculating the information for a text field on a form from a query

    Thanks vbaInet I do have an employee number and also a unique (primary key) ID for each employee. Thing is anyone searching for anything to do with the employee will do so by name. That's why I took the unusual step with this database of not bothering to separate forename and surname like...
  15. G

    Calculating the information for a text field on a form from a query

    I haven't made a start yet and wont be able to until either the wife goes to bed tonight or when I get to work in the AM. It's that old question of whether I value the dbase or my marriage:eek: You know my talent for code cannot be measured (because you can't measure nothing) but I'm...
  16. G

    Calculating the information for a text field on a form from a query

    Hi again The scenario is that someone needs Derek to deliver a course on the 17/08/2014. The course may be a six week course or there may even be three or four courses taking place between August and December. So the Start_Date that they enter on the form [Resourcing] is 17/08/2014. At this...
  17. G

    Calculating the information for a text field on a form from a query

    Yes thanks vbaInet Based on the screenshot that's correct. I've attached a screenshot that shows only Derek. Based on it if I was trying to schedule Derek for 17/8/2014 it would tell me that it was two days since his last holiday on 15/08/2014 and however many till his next on 01/01/2015.
  18. G

    Calculating the information for a text field on a form from a query

    Hi vbaInet The where condition was indeed a financial year condition. I used it to work out remaining holidays as our Holiday year still runs April to March although our financial year is January to December. I will still use that function but will use it from a seperate query as people...
  19. G

    Create multiple records based on date range

    Here's the code that Gerry put into my db Private Sub Create_multiple_records_Click() Dim strSQL As String 'As you are entering the first record manually with the end date the sql only addes the dates greater than the first date 'This only works where all fields are filled in - you should...
Back
Top Bottom