Search results

  1. D

    'Select' parameter query help

    Sussed it. Should anyone else find this useful: Private Sub txtNoDays_KeyDown(KeyCode As Integer, Shift As Integer) Dim SQL$ Dim D% Dim QryDef As QueryDef '--------------------- If KeyCode = 13 Then D = Val(txtNoDays.Text) SQL = "SELECT...whatever"...
  2. D

    'Select' parameter query help

    Hmm... am I getting close? Private Sub cbxQV_Change() Dim SQL$ Dim rs As DAO.Recordset '------------------------- SQL = "SELECT tbl_Extract.Arrival_Time, tbl_Extract.Case_ID_ AS [RT#], tbl_Extract.Status, " _ & "tbl_Priorities.PriDef AS Priority, tbl_Extract.Requester_Name_...
  3. D

    'Select' parameter query help

    I need to passa parameter to a select query that shows info on a subform. I understand that I cannot execute a select query, such as qry.Parameters![ONo] = OrdNo so what is the alternative? How do I do this?
  4. D

    Commit record?

    Thanks (again!) Banana, but updating the record isn't a problem. Its when I exit the form and get the message which I don't believe I should get.
  5. D

    Commit record?

    I run the following code when the user executes a certain event (it records the time an email was sent): SQL = "UPDATE tbl_RMAs SET [FourHour] = '" & Now() & "' WHERE [RMANo] = '" & Me.RMANo.Value & "';" CurrentDb.Execute SQL All is ok until I exit the form. I then get told that the record has...
  6. D

    Delete QueryDef?

    Apologies - its early morning! Public Function FindQuery(QName) As Boolean Dim QryDef As QueryDef '---------- For Each QryDef In CurrentDb.QueryDefs If LCase(QryDef.Name) = LCase(QName) Then FindQuery = True Exit For End If Next End Function
  7. D

    Delete QueryDef?

    :( Sorry to come back on this again but i'm getting a 'variable not defined' error on the line "For Each QueryDef in CurrentDB.Querydefs" pointing at "QueryDef". Why is this? I thiought as it is an object not a variable it shouldn't be defined...
  8. D

    Delete QueryDef?

    Wonderful - thanks a lot! Tut tut! Naughty :)
  9. D

    Delete QueryDef?

    Simple one this maybe! I use the following which works fine: CurrentDb.QueryDefs.Delete "qryTemp" ...but only if "qryTemp" exists of course. I can't guarantee it always will so i'm looking for kind of IfExists("qryTemp") does such exist?
  10. D

    Optional Paramater

    Thanks again Banana, I appreciate your time helping me with this. Bob's document is indeed a very good explanation. However, to get my problem fixed all I had to do was give the subform an initial SourceObject, and it didn't matter what it was (I set it to look at the full table). As soon as I...
  11. D

    Optional Paramater

    "Flipping heck!" Still can't get this working!! To reference the subform on the current form it says "Me!Subform1.SourceObject" I'm using "Me!frmSub.SourceObject = qd.Name" and no go!! (frmSub does exist and is a subform of the current form)
  12. D

    Optional Paramater

    Thanks Banana, very much appreciated.
  13. D

    Optional Paramater

    Hang on, this is to do with referencing the subform cldTemp, not with the object. Ok, how do I reference the subform?
  14. D

    Optional Paramater

    Thanks for that, Banana. I have had a look at using QueryDef instead but still have the refusal to populate the child form because SourceObject wants an object (error 3011 - ...could not find the object '~sq_cfrm_Reporting~sq_ccldTemp...) Private Sub cmdView_Click() Dim SQL$ Dim qd As...
  15. D

    Optional Paramater

    Can't anyone help with this? I'm trying to put something like this in the query criteria (in the QBE) but obviously it will take null as the parameter instead of ignoring it: IIf(IsNull([Forms]![frm_Reporting]![cbxDept]),Null,[Forms]![frm_Reporting]![cbxDept])
  16. D

    Optional Paramater

    Can someone point me in the right direction regarding optional parameters in a saved query? My query is based on a form with combo boxed that the user may or may not select from. I say saved because i'm using: Me.cldTemp.SourceObject = "Query.qry_ByDept" where cldTemp is a subform on a form. The...
  17. D

    Union?

    I have a union query that is not combining correctly. i.e. it is returning all the values from the first part followed by the results of the second. I really wanted them combined on the same row where appropriate - any ideas? SELECT Yr, Mth, CNo, Customer, AON, AOC,Null as CON,Null as COC FROM...
  18. D

    Too few parameters??

    Guus: Have run this query and the other two it relies on maybe 100 times in design mode and it runs perfectly! This is not a parameter query. petehilljnr: No, its not a linked table, its local. It is now giving me a severe headache! :confused: Any more ideas from anyone?? (where is the 'cry...
  19. D

    Too few parameters??

    :confused: I have an append query that is called thus: CurrentDb.Execute "_qry_PopulateTableUnionTemp" It used to work fine, no problems, but I have made some minor changes to my db and now the code fails on this line with the message "runtime error 3061: Too few parameters Expected 2". What I...
  20. D

    This should be simple (marge 2 queries)

    Jon, A million thanks - you pointed me in the right direction and I can feel my sanity return! Actually the SQL didn't like the square brackets, and using union I was able to directly query the tables. Simple when you know how but I needed to know what to look for. :) SELECT Year, Month, Dept...
Back
Top Bottom