Search results

  1. Ken Sheridan

    Merge two tables in query by date/time, preserving hourly time in one of the tables

    Hard to say which would be better. When joining tables on derivative values like this the real drawback is of course that the optimizer cannot make use of the indexes.
  2. Ken Sheridan

    Merge two tables in query by date/time, preserving hourly time in one of the tables

    I'd suggest joining the tables on the formatted date/time values to ensure equality: SELECT tblFish.*, tblFlow.Fish_Count FROM tblFish LEFT JOIN tblFlow ON FORMAT(tblFish.Flow_DateTime, "yyyymmddhh") = FORMAT(tblFlow.Count_Date_Time, "yyyymmddhh");
  3. Ken Sheridan

    I need help. How can I display the Total Amount and Net Amount on the main form? I am not able to do it. Please help.

    Rather than calculating the values for the the computed controls in the form and subform, an alternative would be to return them in the parent form's RecordSource query as follows: SELECT *, DSUM ( "(UnitPrice*Quantity)", "SaleDetails", "SaleID = " & SaleID )...
  4. Ken Sheridan

    Filter with query

    I should have said all orders rather than open orders. To return only the latter the form's default RecordSource would be: SELECT * FROM Orders WHERE NOT Completed ORDER BY OrderDate
  5. Ken Sheridan

    Using multiple criteria in IIF statement

    If those are the only allowed combinations of values you should enforce this constraint with a table-level Validation Rule: ([fldDiscNo] = 0 And IsNull([fldRecordingID]) Or [fldIgnore] = True PS: I see from the examples you posted earlier that other combinations seem to be allowed, so you'd...
  6. Ken Sheridan

    Import Excel file in Database using VBA (learning purpose)

    When importing from Excel, the data will rarely be structured in a way correct for Access, in which data is stored in a set of correctly normalized related tables. The attached little demo file illustrates how data imported from Excel can be recast into a correct predefined structure by...
  7. Ken Sheridan

    Filter with query

    One way would be to amend the form's RecordSource property in code to join the form's default RecordSource to the query. As a simple example lets say you have a form based on the following query: SELECT * FROM Orders ORDER BY OrderDate; Rather than a button you could use a check box to toggle...
  8. Ken Sheridan

    Multi Value Combobox

    The attached StudentCourses file demonstrates a number of possible interfaces for a for a many-to-many relationship type. It includes a multi-select list box, or to save space in the form, a comma separated list. In the latter case the list is edited by means of small dialogue form opened...
  9. Ken Sheridan

    Clear out data

    If you split the database into separate front and backs ends, then you can have one back end file, distinct from your operational back end, with only the data you want others to have, e.g. referenced tables of cities for instance. You'd then distribute the front end with the 'safe' back end...
  10. Ken Sheridan

    2 queries in one form

    The following query references a query qryStockInHand which computes the current inventory per product and returns columns ProductID and StockInHand, and an OrderDetails table with columns OrderNumber, ProductID, Quantity, and UnitPrice. The query returns any orders for which there is not...
  11. Ken Sheridan

    Field to enter ONLY time.

    That's only a limitation of the built in formatting of values of DateTime data type. The underlying value is merely a 64 bit floating point number, so lends itself very easily to doing time arithmetic, and the result can easily be formatted to whatever you wish, e.g. Public Function...
  12. Ken Sheridan

    Conditional Formatting

    Your question is a good example of where Boolean logic operators differ from our use of the same terms in day to day English. As the meaning of does not equal "#1" or "#2" is readily apparent in day to day English, you might think we could express this algebraically like this: x = 3 ? x <> 1...
  13. Ken Sheridan

    Field to enter ONLY time.

    In Control panel. In Category view, select Clock and Region | Change date, time or number formats. The ensuing Region dialogue allows the various default date and time formats to be set. In my case the default time format used by Access corresponds to the Long time format set in the dialogue.
  14. Ken Sheridan

    Field to enter ONLY time.

    In my case it shows as 14:00:00. I would normally set the Format property to whatever is the desired format, however, so the default format is immaterial. I'm guessing the default format set in Windows governs the behaviour in Access.
  15. Ken Sheridan

    Field to enter ONLY time.

    I would suggest that you also apply a ValidationRule property of Is Null Or (>-1 And <1). That will prevent a value other than a time only being inadvertently entered. I don't know whether a Sharepoint list allows this, but. if not, you should at least do it for the bound control in your data...
  16. Ken Sheridan

    Solved DCount Date field for duplicates giving Error#

    You can return a result table of all duplicated dates per machine per employee with a simple aggregating query: SELECT MachineID, EmployeeID, ShiftDate FROM tblShiftMachinesRan INNER JOIN tblShiftDay ON tblShiftMachinesRan.ShiftDayID = tblShiftDay.ShiftDayID GROUP BY MachineID, EmployeeID...
  17. Ken Sheridan

    Report in unbound Form needs dynamic Recordsource and Filter

    One way to restrict a form's recordset is to reference unbound controls as parameters in the form's RecordSource query. The following is a simple example: PARAMETERS Forms!frmEmployees!txtDateFrom DATETIME, Forms!frmEmployees!txtDateTo DATETIME; SELECT Employees.*, FirstName & " " & Lastname AS...
  18. Ken Sheridan

    Filter property or sql Where? OrderBy property or sql Order by?

    In the majority of cases i will reference controls in a form as parameters in the query's WHERE clause. The following is a simple example in which the parameters are three unbound correlated combo boxes in the bound form's header section: SELECT [FirstName] & " " & [LastName] AS FullName...
  19. Ken Sheridan

    Sum Query and text box

    Is the Clients column of text data type, containing the client's name? If so the table should be decomposed so that it contains a ClientID foreign key column of long integer number data type, referencing the primary key of a Clients table in an enforced relationship. A query to return the...
  20. Ken Sheridan

    Why is this not working?

    Beware of names like mine in its original non-anglicized form: Cináed O'Siridean.
Back
Top Bottom