Search results

  1. K

    Random Date Generation

    Oh i get ya. I thought you were taking the p out of my ghghg 'routine'! oops . You can get data into it in various ways - including hard coding as i did above, or if you do want to use boxes on a form then RandDate(Me.StartDateField,Me.EndDateField) If you want to put the value on a form...
  2. K

    Last Question

    Just to post an alternative. You could read it all into an array Dim myAry(200) As String' works fine but variant is probably more correct Dim ctl As Control Dim x As Integer x = 0 For Each ctl In frm If ctl.ControlType = acTextBox Or ctl.ControlType =...
  3. K

    First-time array user

    okay, i'm now very confused about what you're trying to do. The first code section had a loop and looked as though you were using a recordset independently of any form, now you're using each record seperately? I'm trying to see how you will get a running total/average from one record. Are...
  4. K

    First-time array user

    Hi Again Fred, I'm just working my way thru your code at the moment - the first bit of this is just picky, feel free to ignore it - I only include it because it may help When comparing 2 strings strcomp(StringOne,StringTwo)=0 is faster than StringOne=StringTwo As there's no loop in the code...
  5. K

    =Date() & =Time() help?

    Hi, you should set the default value for the field in the table rather than on the form. In the design view of the table you can specify =now() and that will drop on the Date & Time when the record is created - it won't change on future viewing, HTH Drew
  6. K

    Random Date Generation

    You don't need the second at all, that was just me checking that it ran okay - didn't actually mean to post it...Drew
  7. K

    First-time array user

    hi Fred, there's a couple of problems with your loop. Firstly the "Do While True". True is always true so you'll never get out of the loop, you just get and EOF error. You could use "Do While not rstDewPoint.EOF" or "Do Until rstDewPoint.EOF" instead - as soon as you hit the last record...
  8. K

    Random Date Generation

    Hi CaP, the below should work Function RandDate(dtmStartDate As Date, dtmEndDate As Date) As Date Randomize RandDate = DateAdd("d", Int((DateDiff("d", dtmStartDate, dtmEndDate) * Rnd()) + 1), dtmStartDate) End Function Sub ghghg() MsgBox RandDate(#1/13/01#, #1/21/01#) End Sub...
  9. K

    Help Creating a Function

    Hi Aqif, looks like you've pretty much got the answer in your question. You'd make a function that would take a figure as a parameter. eg Public Function Tax_Amt(dblTotalAmount as Double) as Double Tax_Amt = dblTotalAmount - (dblTotalAmount * 2.5) End Function then you'd just call it...
  10. K

    Problems With A Simple While Not EOF Statement

    Hi, it sounds as if you're just going to end up with a table of false's on YN_Holder ( they either already are, or they will be). Why not just use an update query and do the whole lot? HTH Drew
  11. K

    object variable

    hi, you don't seem to have created dollars anywhere, which may not be the problem but as you're treating as a recordset it may well be, also - why are you opening and closing the query at the start? If it's to check that it exists then you can just use an error handler to deal with it HTH Drew
  12. K

    Active & non active fields

    congratulations! You need to set its enabled to false by default and then do something on either exit or after update like if not isnull(me.GottaHaveDataBox) and me.GottaHaveDataBox<>"" then me.CurrentlyDisabledBox.enable else msgbox "Put something in the box please" 'cancel=true '- if on exit...
  13. K

    Adding up yes value in report from form

    Hi, i would guess that the maths is being done fine as suggested above. It may just be the format of the display box - check that it is not set to "Yes/No" - that will display any non-zero result as "Yes". If it is there just remove it and it should be sorted, if not then... don't know HTH...
  14. K

    Using Len function on the contents of a variable

    Hi Aziz, there's probably a smart answer to do with counting bits or bytes or something, but i don't know what it is. In the mean time why not put record_count into a string and get the length of that instead? It should work okay HTH Drew
  15. K

    SQL on a button

    Hi, the only problem is that you're not actualy doing anything with the string after you've set its value. To get it to run just add the line currentdb.execute strsource just before end sub HTH Drew curse these slow fingers... [This message has been edited by KDg (edited 06-25-2001).]
  16. K

    Simple open form questions

    At a guess - is the calling form a popup and the launched form not? That would send the new one to the back HTH Drew
  17. K

    Why Can't I call results of sub routine in my query?

    Yup, spot on. There's a proper way to do it and a quick way. Personaly i prefer the quick way because, er, it's quick i guess. Do do it properly you should loop through the query def collection and check each ones name, if one called "BillyJo" exists then you delete it. The quick way is to...
  18. K

    Why Can't I call results of sub routine in my query?

    If there's no error then the SQL is probably malformed in some way. Have you tried doing debug.print txtPlayers once the string is fully built. If you cut and paste that in a standard access query it should throw out a proper error rather than just ignoring you. Oops - just had another thought...
  19. K

    Label/message inside textbox/combo box?

    Hi Angelo, i think you can do it by setting the default value of your boxes to whatever you want it to say eg "Enter Name" and then placing the below in the form's code somewhere Sub WipeDef() Dim strBox As String strBox = Screen.ActiveControl.Name If StrComp(Chr(34) & Me(strBox).Value...
  20. K

    If, Then, Else..............HELP

    the above is correct but you'll also need to split out the first then statement : If fld1 = "Insurance Medicine" And fld2 = "Occupational Medicine" Then fld3 = "PH" ElseIf fld1 = "Insurance Medicine" And fld2 = "Psychiatry" Then fld3 = "BP" End If otherwise the first if is terminated on the...
Back
Top Bottom