Search results

  1. N

    Open new form based on this record

    There are several ways of retrievng the newly-created autonumber key. If you want to grab it from the form in which it's created, you simply reference the control which is bound to the key in the record source. So if your form control is named xxID you can use the form's BeforeUpdate event to...
  2. N

    IIF Statement to Equal todays date?

    Short Date is a format, not a data type. The field defiition should be set to Date/Time and this will be stored as a number with the integer part being the date and the decimal part being the time. The code I gave you before forces the integer part (i.e. the date) to be returned. So if you...
  3. N

    IIF Statement to Equal todays date?

    What is the value in DateRented? Is it a date and time? If so, the comparison will fail because the time part will never match. You could try:DateDue = Int(DateAdd("d",2,[DateRented))which will force the result to the date part only. Incidentally, your IIf statements must have a false part as...
  4. N

    Subtracting Minutes from a Date/Time Field

    I had a look at NorthWind, but it doesn't have the Venue table, so that must be one you have added yourself? I have created a pair of dummy tables with a query to show the basics of calculating time difference between related fields in the two tables. The result is in the attached zip file. In...
  5. N

    Subtracting Minutes from a Date/Time Field

    OK, so what is the relationship between the two tables? How do you determine which records to get the two times from? I won't respond further on this tonight, but if no-one else has chipped in by tomorrow morning, I'll do so then.
  6. N

    Subtracting Minutes from a Date/Time Field

    My head stopped working years ago!:) In my example, you can substitute [Activity Start Time] for StopTime and [Journey Time] for StartTime. You need the square brackets because the names have embedded spaces. As you only want hours and minutes for the departure time, you can change the format...
  7. N

    Check to see if a box exists on a form.

    ... did you spot my deliberate mistake? (I didn't!). :o The function call in my example should beIf checkIfBoxExists(Me) then <do something>because the parameter passed is the form object and not its name.
  8. N

    Check to see if a box exists on a form.

    A function like this may do what you need.Public Function checkIfBoxExists(ByRef pForm As Form) As Boolean Dim ctl As Control Rem set default return value checkIfBoxExists = False Rem step through all controls on the form For Each ctl In pForm If ctl.Name = "xxx" Then ' 'xxx' = name of control...
  9. N

    Module and Macro

    How is your code invoked? The clue may be in the error message - it says "can't find the function ..." but you have a sub? You can simplify your code like this (whether Function or Sub):Public Function ChangeDataType() CurrentDb.Execute ("ALTER TABLE [FM 1 Cref Make] ALTER COLUMN [CALL_IN_REF]...
  10. N

    consultation with field for multiple criteria

    I still don't understand what you are trying to do. I have studied the images you posted, but even with the explanations, I can't decipher the part which relates to your original question. It doesn't help that I don't understand the language on the form (sorry :o). Can you define what you mean...
  11. N

    Query date criteria problems

    I forgot to ask what are the field types you are using? I assume Date/Time, but the string for date and time as you show it would be the result of formatting the underlying data, unless it's a string field, in which case it's a literal. I hope it's the former!:)
  12. N

    Query date criteria problems

    Did you mean to attach some images? I don't see them?:confused: I assume you are taking screen shots of your query design - if so, it would be easier to show the SQL - with the query open in design view, right-click and select SQL view. Copy the entire SQL string from that screen and post it for...
  13. N

    Allow form to modify a table, while fetching data from another

    Create a query which gathers the related fields you need and use that as the form's record source. It not a good idea to copy data between tables a a rule - better to link the output field to the original source (i.e. a pointer from the output table to the source table).
  14. N

    Query date criteria problems

    Can you post your query, please? This will help us to understand the context better. You are entering dates in UK format dd/mm/yyyy, but in the query they should be American format mm/dd/yyyy. I don't think this explains your problem from the data samples you have given.
  15. N

    Creating Final total

    Your details are somewhat sketchy, but something like this should do what you need:SELECT Sum(Quantity*Price) AS Total FROM table;Sustitute your filed names for 'Quantity' and 'Price' and your table name for 'table'. You can put this in your parent form as the data source for a textbox control...
  16. N

    Subtracting Minutes from a Date/Time Field

    This query retrieves the difference between two time fields in a table and formats the result as hours, minutes & seconds.SELECT Format((StopTime - StartTime) ,"hh:mm:ss")AS Duration FROM TableName; I don't quite follow your logic of calculating departure time when you already have the start...
  17. N

    String Function

    One possibility is the Select Case statement.Function code(x) As String Select Case x Case 1, 2, 3, 4, 5: code = "Alpha" Case Else: code = vbNullString End Select End Function
  18. N

    Open new form based on this record

    Where is your Command54 button - is it on the frm_StudentInfo form? Also, where are the fields named in your INSERT string (Text4 etc.) located - are they also on that form? And is the form bound to table RepairInfo? If the answers to these questions is "yes", then why do you use DoCmd.RunSQL to...
  19. N

    SELECT TOP 1 problem

    Can you provide an example of what you want to do? I can't visualise what you need from the description given. I suggest you illustrate an entry from your table of tables and show how it relates to the other tables you have. From what I see, I don't think using "TOP 1" will do what you want, so...
  20. N

    consultation with field for multiple criteria

    Can you provide some context to your question and provide sample data, please? I don't understand what "the step" means and there is no indication of its data type. How is this related to the dates?
Back
Top Bottom