Search results

  1. W

    Conditional statement assist

    It sounds like a problem with the code that is freeing the bed. As you are most likely storing the gender in the database, make sure that the gender is set back to null or an empty string when the bed is made free, and also check that zero length strings are allowed in that field. Other than...
  2. W

    Directory Search for String

    or maybe just pass in c:\files in your original function? Not to hot on VB file handling, but seems to me that's all that really needs to be done.
  3. W

    Compare different data tables for similarities

    Is there any particular reason why you have the data repeated like this? The standard idea is to have the master list, and do away with the partial lists, as there are plenty of ways to query the master list for the information you require (for example "SELECT * FROM Items WHERE Y" where Y is...
  4. W

    Out of context in watch window

    I'm curious as to what this code is being used for as well. From all that has been said, you seem to be using a function with almost identical code lots of times and using a seperate fuction for each one. Wouldn't it be better to, for example, pass in the filename as a parameter etc. Some more...
  5. W

    subforms, textboxes, variables

    try principle = Me.sub_grant_calculation_form.Controls("txtGrant") provisional = Me.sub_grant_provisional.Controls("txtGrant")
  6. W

    Linking "chains of Information

    If you have a table containing all the previous owners of a property, you just get a recordset containing all of them, and you have your history of who has owned the property. Just sort it by the date they pruchased/sold :)
  7. W

    Find recs,count and take decision

    use the sql SELECT COUNT(*) AS result FROM table WHERE <criteria> to run a search and put the result into a recordset. Then use rs.fields("result") in your statements as the number of records etc so If rs,fields("result") = 1 then do something Else do something else End If
  8. W

    to find duplicate records from the table and mark them latest based on revision no.

    SELECT *, DISTINCT <field1> & <field2> & <field3> AS ProductID FROM <table> ORDER BY Revision DESC as so on, adding as many fields into the distinct row as you need
  9. W

    Linking "chains of Information

    I think you need to look at the structure of you tables a bit. You shouldn't need a table for each property, each property should be a record in a table. Once you have that, then you can have a table which can hold the details of the original oweners of a property linked to the property table...
  10. W

    Selecting Printers

    Have attached a file containing modules that allow you to select a default printer through code. They are fairly well documented so you shouldn't have too much trouble figuring out how to use them :) Hope this helps
  11. W

    to find duplicate records from the table and mark them latest based on revision no.

    How about just a single query along the lines of the following SQL statement SELECT *, DISTINCT productID FROM <table> ORDER BY Revision DESC If the * doesnt work, then replace it with all the records you need to view in this query. What this should do though is return the highest revision of...
  12. W

    CREATE TABLE with decimal

    DoCmd.RunSQL "CREATE TABLE Temp (Speed_Band Text, Site_ID INTEGER, In NUMERIC(10,2), Out NUMERIC(10,2));" hopefully the above will help. You also might want to change the In fieldname to something else as In is an sql reserved word.
  13. W

    Concatenate a string in If statement

    Try if (Me.Controls("Media" & intLoop) = -1) then instead.
  14. W

    How to use Iif and EOF

    heh :) rural guy, I just kinda made the assumption in my reply that if its in a string like that, then kupe can export and use it whereever they need to.
  15. W

    How to use Iif and EOF

    Easiest way would probably be to find all your chosen records using an sql select, dump them into a recordset, then do something like the following Do while not rs.EOF strResult = rs.Field(1) & "|" rs.MoveNext Loop strResult = Right(strResult, 1)
  16. W

    Next Try

    Try this as a more readable way of doing this For intCount = 2 To 12 'start the for loop If intMM >= 9 And intMM < 12 Then strCell = intMM + 1 & "/0" & intYY ElseIf intMM < 9 Then strCell = "0" & intMM + 1 & "/0" & intYY ElseIf intMM = 12 Then strCell = "01/0" & intYY + 1 intMM = 0 intYY =...
  17. W

    Variables with " in them.

    either check it over and replace it with single quotes (if you can) or look up how to do parameterised lookups on google.
  18. W

    Data Type mismatch

    MySql = MySql & "Whatever" not MySQL = MySql + "Whatever" Also, a >= operator makes no sense when comparing a text field, so you should probably have Actuals.[TBCS Code] >= " & "01" & " And Actuals.[TBCS Code] <= " & "07" & "))) " without the additional single quotes
  19. W

    Next Try

    one last tweak to that now I look at it again Private Sub MM1_YY_LostFocus() Dim strDate As String, strCell As String Dim intMM As Integer, intYY As Integer, intCount As Integer, i As Integer strDate = Me.MM1YY intMM = CInt(Left(strDate, 2)) intYY = CInt(Right(strDate, 2)) for intcount = 2...
  20. W

    SQL and VBA

    the extra spaces change it from FROM ContactsWHERE to FROM Contacts WHERE. As RuralGuy has put, the [] brackets tell access where a name is, so if you have FROM [Contacts]WHERE, it will see the brackets around contacts, pull the entire thing out as a table name and then go on to the next bit...
Back
Top Bottom