Search results

  1. B

    Need help with Access VB nested If Statement

    Agree with the previous 2 answers, and I would use Select Case. But if you want to use nested Ifs, the problem is you haven't closed the first If. Add another End If before End Sub.
  2. B

    creating passwords

    Here's one I did earlier Private Sub cmdNewPwd_Click() '****************************************************************** '* Generate an 8 character pseudo random password in the format '* [A-Z][a-z][special char][0-9][special char][A-Z][a-z][0-9] '* This gives 24,174,030,400 combinations to...
  3. B

    Pass-Trough query by VBA procedure

    See the principle of how to do this halfway down this thread http://www.access-programmers.co.uk/forums/showthread.php?t=134597
  4. B

    insert into with vba

    Check the data type of the charge field. Are you trying to insert '14.50' as text when you should have a numeric value. If so remove the '' from round vl. 'hours' appears to be text and 'qty' numeric; check thats right, and also check whether they are required and/or zero length is allowed in...
  5. B

    Code to run at DB Startup

    Best practice is probably to put the code in a module then call it from the open event of your form rather than actually have it in the form, although it doesn't actually make any difference in coding terms. Sounds like you have the 'set date' hard-coded somewhere. You need to store it in a...
  6. B

    Executing select statement in vba

    Sorry, missing ) from the end! The & part is not a line break, it's because txtCIntNum is a variable and so has to be parsed outside the SQL string. You can miss the final & ";" off without any problems, it's just good practice to put it there so you know that's the end of the SQL, but it's...
  7. B

    Hidden check of user info

    Create a new query in your FE and save it. Don't add any tables, just leave it blank and save it. Now find the path of your BE database eg R:/Server/MyDb.mdb To use your new query without storing any links just paste the SQL as in previous post but with an 'IN' clause to specify the path eg...
  8. B

    Hidden check of user info

    No your pass-through query will be on the FE and will link to the BE, but it doesn't link to any specific table, just to the database, so you can use it to select anything you want from the BE. Only when you paste the SQL does it know what table it's selecting from, and deleting the SQL then...
  9. B

    Executing select statement in vba

    Open a recordset using the SQL then populate strClient and text box from that. dim dbs as database dim rst as recordset set dbs=CurrentDb set rst=dbs.OpenRecordset("Select [ClientName] from Clients where [ClientNum] = " & txtClntNum & ";" strClient=rst!ClientName set rst=nothing set dbs=nothing
  10. B

    Hidden check of user info

    You could use a pass-through query rather than linking the table. Connect a pass-through query to the BE database and save the connect string then paste the SQL you use to query the user table from code as below, run it, then clear or overwrite it afterwards to leave no trace. paste SQL...
  11. B

    SQL help

    It may have created you a valid text string but that doesn't mean it's a valid piece of SQL! It definitely will not run with a 'naked' date/time string in there. Try replacing Now() with .....#" & format(Now,'dd/mm/yyyy') & "#.....
  12. B

    Select Range of Fields from a Table

    Assuming the bound column of combo1 is EquipmentID, then your rowsource for combo box 2 is selected from tblMaintenance again using EquipmentID to filter it: so something like "SELECT Size FROM tblMaintenance WHERE EquipmentID=" & Combo1 & ";" As Dennisk says, refresh this on the After Update...
  13. B

    Check if networked computer is on?

    To see if the machine is alive and on the network you should be able to ping it, if you know its IP address and/or host name. You can use VB code (Google for it or search http://vbnet.mvps.org/), or you can write a batch file and call it using Shell. Both of these will need a bit of work however!
  14. B

    Select Range of Fields from a Table

    I have no idea what your problem is! Please explain what you want to do and which bit you're having trouble with.
  15. B

    SQL help

    Paste: SELECT * FROM [Andrews HWST] WHERE [Andrews HWST].andrews_date_datalable Is Null; into a query to make sure you have some records that qualify. If no records are returned for Null try SELECT * FROM [Andrews HWST] WHERE [Andrews HWST].andrews_date_datalable =''; in case you have empty...
  16. B

    SQL help

    Now() is a variable so you have to lift it out of the string or Access reads it literally. It should look like this "UPDATE [Andrews HWST] SET [Andrews HWST].andrews_date_datalable = '" & Now() & "' WHERE ((([Andrews HWST].andrews_date_datalable) Is Null)); Note the single quotes insode the...
  17. B

    SQL help

    Product.product_lablecodeFROM =no space Product.product_nameWHERE =no space hence missing operator
  18. B

    SQL help

    When you wrap the string always leave a blank at the beginning or end of the line as below, otherwise the string runs the 2 lines together. So 'Product.product_name" & _ "WHERE' Will parse to: 'Product.product_nameWHERE' and fail Add spaces like this: Product.product_name " & _ " WHERE
  19. B

    Error Handler screwing up

    What you should have is: Err_Exit: Exit Sub Err: MsgBox "There was a problem opening the Report" & vbNewLine & "Please try again", vbInformation, "There was a problem" Exit Sub You need to drop out before the error handler if everything's OK, otherwise you hit it every time!
  20. B

    Error Handler screwing up

    I assume you've put something like an Err_Exit: Exit Sub at the end of your main code and before the error handling code so that it doesn't just drop into it every time?
Back
Top Bottom