Search results

  1. waxdart23

    Passing Date values from form to module

    I have worked out that is because the VB code uses the date in US format. How to re convert it back to UK format. I tried - Dim DateConv As Date DateConv = Format(Me.SDate, "dd/MM/yy") But it didnt work.
  2. waxdart23

    Passing Date values from form to module

    Whilst waiting for a reply I had a go and used the code below - Call UpdatePerformanceAdd(StewID.Value, DateValue(SDate)) Public Sub UpdatePerformanceAdd(lStew_Num As Long, StartDate As Date) This doesnt work, the query in my module which uses the date value as a filter (ie all records where...
  3. waxdart23

    Passing Date values from form to module

    I currently use - Call UpdatePerformanceAdd(StewID.Value) to pass an integer value to a module for use in the VB code - Public Sub UpdatePerformanceAdd(lStew_Num As Long) I know wish to pass two date values from the same form to the same module to use in a query in the module. I'm not sure how...
  4. waxdart23

    Using value from table in VB

    It now works Many thanks to everyone who helped on this.
  5. waxdart23

    Using value from table in VB

    This is giving a type mismatch now. Field is formated correctly (see attahced jpeg) and I can't find anywhere else that refers to the field format. Everything looks OK, but it refuses to work. It's official... I hate Access.
  6. waxdart23

    Using value from table in VB

    Wayne - Thanks, I realised it was an example but it is a coincidence that the column I wish to add is the fourth. Carmen - Your suggestion stops the error but returns a value of zero. The fields I am trying to add are required long intergers.
  7. waxdart23

    Using value from table in VB

    I used the code as below - Dim intLoop As Integer Dim lngSum As Long lngSum = 0 For intLoop = 1 To Me.lstSicknessCount.ListCount lngSum = lngSum + Me.lstSicknessCount.Column(3) Next intLoop I got an "Invalid use of Null" error (Run-time error '94'), highlighting...
  8. waxdart23

    Using value from table in VB

    I am using the follwing code to count the number of records returned to a list box from a query - If Not Recset.BOF And Not Recset.EOF Then Recset.MoveFirst Recset.MoveLast NoOfPeriods = .RecordCount Else NoOfPeriods = 0 End If The same query returns a value of days (stored as an integer) to the...
  9. waxdart23

    Compile Error with Form Code

    Solved. Many Thanks.
  10. waxdart23

    Compile Error with Form Code

    additional info to above The error I get highlights the following - Recset As DAO.Recordset
  11. waxdart23

    Compile Error with Form Code

    I have a form which, after selecting a "Staff" record and a year from two seperate comb boxes should list all sickness records for the selections in a list box. I am using the following code to do this - Private Sub cmbYearSelect_AfterUpdate() Dim StartDate As Date Dim EndDate As Date...
  12. waxdart23

    Filtering displayed data on subform

    This is functionality requested by the eventual user and I'm don't like to dissapoint!!
  13. waxdart23

    Filtering displayed data on subform

    I have a database used to store staff sickness. It currently consists of a "Staff" table to store staff details (name, number, salary etc) and a "Sickness" table to store sickness records. I have produced a form to displaying staff's name from "Staff" table and then a sub form containing...
  14. waxdart23

    Run-Time error '424'

    I tried this and it is still ignoring the date filter. I tried running it as below and obviously got an error as the WHERE statement is incomplete. strSQL = "SELECT Performances.ID, Performances.Perf_Date, Performances.Duration FROM Performances " strSQL = strSQL & "WHERE...
  15. waxdart23

    Run-Time error '424'

    Thanks, using DateValue(DateStart) stopped the errors. However this date value is meant to act as a user entered date filter so that only records with a date >= this value is copied into the joining table. When I run this it adds ALL records regardless of the date. So this filter isn't working...
  16. waxdart23

    Run-Time error '424'

    I am using the following to pass two items of data from a form to a Module - Call UpdatePerformanceAdd(StewID.Value, StartDate.Value) The module is as follows - Public Sub UpdatePerformanceAdd(lStew_Num As Long, lStartDate As Date) Dim Dbs As Database: Set Dbs = CurrentDb Dim rstPerf...
  17. waxdart23

    Formatting values for time

    Thanks Mile-O-Phile, your function worked a treat.
  18. waxdart23

    Formatting values for time

    I am trying to add a range of time durations on a form but when the total value of hours is larger than 24 it goes back to zero. eg If the total amount of hours is 40hours 30minutes then the total shows as 16:30. Is there a formatting I can use so that Access recognises that a time is a value...
  19. waxdart23

    Exporting Pivot Table

    I use the following code to export (from a form) the results of a saved query (Hoursworked) to Excel. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "HoursWorked", "C:\path\hoursworked.xls" MsgBox "Hours Worked Exported.", vbInformation, "Message" I know have a pivot...
  20. waxdart23

    Counting a query

    Worked a treat. Many thanks.
Top Bottom