Search results

  1. S

    number of records?

    And this is the line immediately after the Set db = CurrentDB line? Something is very wrong here. Can you print CurrentDB.Name? Try Set db = DBEngine(0)(0) instead. Does that work? Try moving the Sub to a brand new non-form module. Any of these working?
  2. S

    number of records?

    "Run-time error 91: Object variable or With block variable not set" means that you are using a reference to an object which doesn't exist. (Ignoring the With part of the error message, seeing as you're not using a With statement.) Since you are saying the error occurs on the statement which...
  3. S

    Using DCount

    This forum could use a flag that only the poster could set to say 'Solved' so that people don't write replies when they're not needed! Seen that on other forums. Glad you got it going. Bad programming this, but you can do it in one line if you want: intCount = CurrentDB.OpenRecordset("SELECT...
  4. S

    number of records?

    Looks like good code to me. I'll ask again though, does the database compile properly? In any code window go to the debug menu and select the top item. If so, you've got to start stripping the code down. Change the SQL statement to a simple one-liner. Shouldn't help, but you never know. If...
  5. S

    number of records?

    Can you compile your database? If so copy and paste in here the exact code on which the error is occurring.
  6. S

    Using DCount

    Once you start writing VBA code it is pretty much time to leave DCount behind. I haven't used it for a long time, but I'm fairly sure there is no way to get it to do what you want. Someone can correct me if I'm wrong. What you need to do from here is to start using the query builder to make a...
  7. S

    number of records?

    This should do it: Dim db As DAO.Database Dim rs As DAO.Recordset ... Set db = CurrentDB Set rs = db.OpenRecordset(strSQL) if rs.EOF then intCount = 0 else rs.movelast intCount = rs.RecordCount end if ...
  8. S

    3075 Syntax Error

    Rather than trying to execute the two statements, when trying to debug just debug.print them or MsgBox them together and see what is different. It should be readily apparent what is going wrong.
  9. S

    Null Recordset

    EOF All he needs.
  10. S

    number of records?

    Out of curiosity have you gotten the non-count method to work? IE, for the users who do want to see the details? If so you must be successfully creating a SQL string which returns records whether from Access or from MSSQL, so you can create a recordset and get a recordcount very easily...
  11. S

    problem with updating tables

    I've never seen an INSERT query alter any other record, in fact I'd bet it is impossible. Do you have an autonumber primary key? Are you sure you're looking at the new record? Where do you think your VALUES clause is getting the rest of its data from, by the way? It is expecting constants...
  12. S

    make QRY, get data, Del QRY...Surely there's a better way

    No, you never need to use queries, go straight from SQL string to recordset. I'm always needing a value from the database from a piece of SQL code. You can get it down to one line, though it is not advisable to do so. Dim dbs As DAO.Database Dim rsUpdatetable As DAO.Recordset 'Sorry to rename...
  13. S

    Procedure too Large

    (This is a response to your second post, if you want an idea about the tagging methid, ask, but these are probably better.) OK, well I'm still not crazy about the way you're doing this, but if you must do it like this then you could do this: lblEn.Visible = ([Subject] = "EN") txtenc.Visible =...
  14. S

    Procedure too Large

    There are loads of approaches to this, although it seems as though you're trying to have two completely different screens in the one place, when you might as well have two forms, or tab pages or something like that. Anyway, are there only two cases? In each case, is the set of controls visible...
  15. S

    Multiple instances of one report

    I think this is quite complicated and I suspect there might not be a good answer to it. I have a report which has subreports which are not pre-determined, but rather sourced from a table when the report is opened using VBA code. This normally works fine. I now need to open my main report in...
  16. S

    How to create a variable with the name of a variables content?

    Basically, no. You can't do it the way you would in PHP. I have no idea why this is useful to you, but I suspect you are trying to do something the wrong way. Still, supposing you have your reasons, the best Access gives you is a collection object. Dim col as New Collection gives you a...
  17. S

    about DAO Recordset

    In DAO if you just open a recordset based on a table name it opens a table-type recordset, which doesn't support the Filter property. Use the dbOpenDynaset with OpenRecordset to get a dynaset-type recordset and this should work. I had to look this up though as I never really use the Filter...
Back
Top Bottom