Search results

  1. K

    Record Count Condition Not working

    Sorry for the lack of completeness. The preceding code is as under: Sub EmailPM() ' Being used to issue a periodic email to PMs Dim MyDb As DAO.Database Dim rsEmail As DAO.Recordset Dim sToName As String Dim sSubject As String Dim sMessageBody As String Set MyDb = CurrentDb() Set rsEmail =...
  2. K

    Record Count Condition Not working

    I am trying to run following code before issuing an email. So if there are records in the query, I should be able to fire off an email. If RecordCount = 0 Then MsgBox "There are no DVs to be procesed. Please try later." Cancel = True Exit Sub else .... But this does not seem to be working...
  3. K

    Query Formulae as VB code

    Many thanks for your kind help.
  4. K

    Query Formulae as VB code

    Thanks. I changed it to the following but then the code excution stops at 'Null' invalid use of Null. Run time error 94. Public Function ReturnReqDate(strDivision As String, strDevCode As String, dteSiteStart1 As Variant, dteTradersComp As Variant, dteBuilderComp As Variant) As Date On Error...
  5. K

    Query Formulae as VB code

    Thanks. I merely changed the first line to: Public Function ReturnReqDate(strDivision As String, strDevCode As String, dteSiteStart1 As Date, dteTradersComp As Date, dteBuilderComp As Date) As Variant
  6. K

    Query Formulae as VB code

    Thankls Paul. I already tried that too but there was not no ce except for the fact that values were reported as text. But errors remained the same.
  7. K

    Query Formulae as VB code

    Hello Paul, If i could bother you a little bit more. I managed to get the function working well. However, I am still getting errors especially in those cases where all three dates are not there. Need litlle your help in removing these errors. I have attched the tem db for your perusal. Cheers
  8. K

    Query Formulae as VB code

    Understand. Many thanks. I should be Ok to build the rest of the function. Appreciate your patience.
  9. K

    Query Formulae as VB code

    Thank you kindly. Yes I could successfully run an iif expression in the query but there were so many variants that Access could not handle all statements. Is there a way we can fix the expression in the query so that a function can be used?
  10. K

    Query Formulae as VB code

    Thanks a lot. When I ran with amended syntax, I got 12:00:00 AM in all cases. Did you get the same when you ran? I have uploaded the db again which has the correct fields in it. I am sorry I did not pay much attention to the contents of query when creating this emp db. I will definitely add...
  11. K

    Query Formulae as VB code

    Thanks. I have attached the db. Basically, I would like to run a query to show me the required date using a function. Cheers AK
  12. K

    Query Formulae as VB code

    Thanks I tried to call it but my query does not accept parenthesis in my expresion. Is there a particular format for calling a function other than this? Test:ReturnReqDate
  13. K

    Query Formulae as VB code

    Thanks. I changed it as under but am I expected to supply the arguments in the brackets if I were to test it. I was merely using this function in a query to work out the right date by testing criteria based on the function. Public Function ReturnReqDate(strDivision As String, strDevCode As...
  14. K

    Query Formulae as VB code

    I improved the code little bit more but now I get 12:00:00 AM as the retun value. Public Function ReturnReqDate() As Date On Error GoTo Err_ReturnReqDate Dim strDivision As String, strDevCode As String, dteTradersComp As Date, dteBuilderComp As Date If strDivision Like...
  15. K

    Query Formulae as VB code

    Sorry to bother you again. I have used the following function but it gives me a type mismatch error. I am not too sure why do I have to declare Division as string as I have other criteria too. Therefore, I removed it from the function name. May be I am wrong. Public Function ReturnReqDate()...
  16. K

    Query Formulae as VB code

    Much appreciate. Will give it a go. Thanks for guidance.
  17. K

    Query Formulae as VB code

    Thanks a lot. I looked at the primer. As it does not quite show any example code, I was wondering if you could help me create just a line of code and I can then replicate the same. Do I need to declare any variable? Cheers
  18. K

    Query Formulae as VB code

    I have to use a lot of variations to figure out delivery required dates. I can have only limited number of formulae in the query. Is there a way to put all these conditions in vb and apply the result into a query. Following is an example but these could be up to ten formulae with changes in...
  19. K

    Help with Dcount Function

    I am very grateful for your help.
  20. K

    Help with Dcount Function

    I am using the following function in a report which can be triggered from a form for the associasted record. I can't seem to get it right. I am trying to count number of records in tbDV matching project ID but I also would like to apply a condition that this count should include only records...
Back
Top Bottom