Search results

  1. VilaRestal

    Refer to a Recordset Variable by name

    I meant to use Eval in the query. You might have to wrap Eval in your own function to allow a query to use it. You could then refer to the recordset by name as well as the function by name: e.g. SELECT Eval('ProcessRecordset(rs1)') FROM Table1 WHERE ... and of course 'rs1' could passed as...
  2. VilaRestal

    Dropdown boxes - filtering alphabetically

    A combobox can only display one item in its textbox area. It's only one line deep. However, you can force it show the dropdown list using the DropDown method. In this case perhaps on the combobox's change event: Private Sub Combo1_Change() If Len(Me.Combo1.Text) > 0 Then Me.Combo1.DropDown...
  3. VilaRestal

    Refer to a Recordset Variable by name

    Could you use the Eval function Let's say your main function is FuncMain(ByRef rs As ADODB.Recordset) Use Eval("FuncMain(" & RecordsetName & ")") I've not tried so I'm not sure.
  4. VilaRestal

    Tying to compare dates.

    Do you mean filter out those that don't or those that do? AND tA.[notification number] = tB.[notification number] or AND tA.[notification number] <> tB.[notification number] in between the other AND lines (And no not getting annoying but feel free to click the Thanks button or the Add to...
  5. VilaRestal

    Tying to compare dates.

    Blanks? Where PGI Date is null? you can add another criteria for that: SELECT tA.ID, tA.[Serial #], tA.[PGI Date], tA.[Close Out] FROM [Instrument DB] AS tA INNER JOIN [Instrument DB] AS tB ON tA.[Serial #] = tB.[Serial #] WHERE tB.ID <> tA.ID AND tA.[PGI Date] IS NOT NULL AND tB.[PGI Date]...
  6. VilaRestal

    Using "ALL" in drop down to return All records option.

    Correction, stupid Access SQL says "query must contain a table". You can get round that with: SELECT 'All' AS ProgramRecID FROM (SELECT TOP 1 * FROM Table1) UNION SELECT ProgramRecID FROM... Table1 can be any table with at least one record in it and without a ProgramRecID field. Preferably a...
  7. VilaRestal

    Using "ALL" in drop down to return All records option.

    I think you can set the rowsource of the combobox to this: SELECT 'All' AS ProgramRecID UNION SELECT ProgramRecID FROM... Then in the code check if ProgramRecID = 'All' and only set strWHERE if it isn't.
  8. VilaRestal

    Tying to compare dates.

    It needs square brackets if table name has spaces: SELECT tA.ID, tA.[Serial #], tA.[PGI Date], tA.[Close Out] FROM [Instrument DB] AS tA INNER JOIN [Instrument DB] AS tB ON tA.[Serial #] = tB.[Serial #] WHERE tB.ID <> tA.ID AND (Abs(DateDiff('m', tB.[PGI Date], tA.[Close Out])) < 4 OR...
  9. VilaRestal

    Tying to compare dates.

    Create a new query (not the query wizard) Cancel adding a table Switch to SQL view Paste it in there (remembering to change Table1 to what it should be)
  10. VilaRestal

    Tying to compare dates.

    I think this should do it: SELECT tA.ID, tA.[Serial #], tA.[PGI Date], tA.[Close Out] FROM Table1 AS tA INNER JOIN Table1 AS tB ON tA.[Serial #] = tB.[Serial #] WHERE tB.ID <> tA.ID AND (Abs(DateDiff('m', tB.[PGI Date], tA.[Close Out])) < 4 OR Abs(DateDiff('m', tA.[PGI Date], tB.[Close...
  11. VilaRestal

    Recall the previous value of a record on form

    Assuming your field is still called [Value] then its old value (before it was modified) is: Me.[Value].OldValue I only say it may be all you need because it gets overwritten when the record is saved. So if you want to keep the Old Value even after it's saved then you do need to store it somewhere.
  12. VilaRestal

    Recall the previous value of a record on form

    Bound controls have an OldValue property. That might be all you need. What do you want to do with this old value? (But anyway, to do exactly what you ask just assign the hiddenbox the value of the field in the form's current event: Private Sub Form_Current() Me.hiddenbox = Me.[Value]...
  13. VilaRestal

    Verifying Code format

    Indeed, I did mean that :)
  14. VilaRestal

    Verifying Code format

    It's a better way of executing the SQL string: As you can see it doesn't require turning off warnings. And if the SQL encounters errors then it will raise a VBA error so the user will be aware it hasn't worked. DoCmd.RunSQL would stay silent about any failings on the SQL side.
  15. VilaRestal

    Verifying Code format

    Looks fine to me. Although I would replace: DoCmd.SetWarnings False DoCmd.RunSQL strSQL DoCmd.SetWarnings True with CurrentDb.Execute strSQL
  16. VilaRestal

    Composite primary keys

    So I see. Thanks for the example. Interestingly it works fine with QueryDefs: Sub UseCurrentDb() Dim qdf As DAO.QueryDef Set qdf = CurrentDb.QueryDefs(0) MsgBox qdf.Name End Sub So, yes there is this one situation where CurrentDb needs to be given a variable to hold it: when you...
  17. VilaRestal

    Coding For API

    Good to hear. That's a funky bit of functionality your database has there ;)
  18. VilaRestal

    Composite primary keys

    Let's try and keep this friendly and not take people's assertions personally. I would say your original points Galaxiom were a little bit nitpicky themselves (the examples were quite obscure) so a bit hypocritical to accuse Chris of that. What's more, they appear to be wrong: "Try passing...
  19. VilaRestal

    "Transpose" in the form

    Now you didn't mention that before. That certainly is not possible in a subform. However, it could be done in 12 subforms. Each one filtered to show a certain range of 14 tests. Get one working correctly and then copy and paste it 11 times and change the filters on each.
  20. VilaRestal

    Option Explicit

    OK, to directly answer the question: You declare variables with Dim inside a sub Dim txtClosingDate As String or with Private or Public outside a sub Private txtClosingDate As String Public txtClosingDate As String However, that variable name looks like it might be meant to be a reference to...
Back
Top Bottom