User Profile

Collapse

Profile Sidebar

Collapse
Andrew Thackray
Andrew Thackray
Last Activity: Jan 24 '07, 08:13 AM
Joined: Oct 24 '06
Location: Woolongong, Australia
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • The issue probably is with the type of cursor you opened in the recordset.

    I've had this problem myself & found if I replace the recordset.updat e command with the Recordset.updat ebatch coimmand the database is updated immediately. Otherwise the command is not committed unti lyou leave the procedure or close the connection
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to Randomizing a function?
    Sorry - hit enter before I finished. The code should read

    Code:
    dim x as int
    
    x=rnd() * 100
    if x >=50 then
             Put your code to close here
    else
            Put your color change staterment here
    end if
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to Randomizing a function?
    use the rnd() function

    As in

    Code:
    dim x as int
    
    x = rnd() * 100
    if x => 50 then
    See more | Go to post

    Leave a comment:


  • You can only get the record count and absolute position if you open the recordset using adopenkeyset or adopendynamic as the cursor type. The other cursor types don't populate the recordset until requested so the recordcount & absolute position are not known and always appear as -1
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to Help with loops.
    This is a routine which uses the Windows API sleep function to sleep the program.

    put the declare statement in the beginning of the module where you add the sleep subroutine

    It doesn't tie up the CPU for other conncurrent applications while the thread is sleeping

    call the sleep module as follows

    Sleep 200

    sleeps the program for 200 milliseconds

    Code:
        Public
    ...
    See more | Go to post
    Last edited by Killer42; Mar 30 '10, 10:16 AM. Reason: Corrected end-of-code tag

    Leave a comment:


  • Andrew Thackray
    replied to Help with loops.
    This is a routine which uses the Windows API sleep function to sleep the program.

    put the declare statement in the beginning of the module where you add the sleep subroutine

    It doesn't tie up the CPU for other conncurrent applications while the thread is sleeping

    call the sleep module as follows



    Code:
        Public Declare Sub sapiSleep Lib "kernel32" Alias "Sleep"
    ...
    See more | Go to post
    Last edited by Killer42; Mar 30 '10, 10:15 AM. Reason: Added the /CODE tag at end of code

    Leave a comment:


  • This code does the trick. It deletes all rows with a number in column A and stops at the first row with an emplty column A

    Code:
    Sub DeleteNumericRows()
    
    Dim x As Integer
    Dim Y As Double
    Dim Contents As String
    
    On Error Resume Next
    x = 1
    
    NextRow:
        Contents = Cells(x, 1)
        If Len(Contents) > 0 Then
            Y = CDbl(Contents)
    ...
    See more | Go to post

    Leave a comment:


  • The type of code you need to retrieve records using ADODB data objects is as follows

    Code:
    Dim Conn as ADODB.connection
    Dim Rs as ADODB.Recordset
    DIim SQL as string
    conn.connectstring = "The string needed to connect to your database"
    conn.connect
    
    ' put the code to build your SQL string in the variable SQL here
    
    rs.open SQL,conn,adopendynamic
    if rs.bof
    ...
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to VB - Select case
    since yor case stement is selecting on a string value you need to quote the values. The correct code is

    Code:
    Select Case strwhichoption
    Case "Reina"
    TextBox17.Text = "5"
    TextBox29.Text = "31"
    Case "Cudicini"
    TextBox17.Text = "2"
    TextBox29.Text = "30"
    Case "Sorensen"
    TextBox17.Text = "3"
    TextBox29.Text
    ...
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to Access / SQL query
    try this


    Code:
    SQL = "SELECT * FROM Werknemers WHERE month(now) = month(DateOfBirth) and day(DateOfBirth) - day(now) > -1 and  day(DateOfBirth) - day(now) < 6
    See more | Go to post

    Leave a comment:


  • use NOT as in

    a = not b

    This will invert the bollean where a & b are booleans
    See more | Go to post

    Leave a comment:


  • The error vis that you have names your sheet "Selection Sheets" instead of "Selection Sheet"

    "Selection Sheets" does not exist & therefore any reference is out of range

    A
    See more | Go to post

    Leave a comment:


  • The problem is that you are referencing values the worksheet that is active when your macro is executed which is not the worksheet "Price Sheet".

    Hence the if statements will never be true and the "Price Sheet" never selected

    The following modification specifies the ranges on the worksheet "Price Sheet" explicitly and should work

    [CODE]
    If Sheets("Price Sheet").Range(" G13")...
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to Is there an AND IF Function
    Not sure what you mean. There are only two ways to execute multiple if statements. You can make each if/end if follow on after the previous one as in the first example I gave in the reply to your previous post or you can nest if statements using the ELSE /IF construct I gave as the second example.

    However you can use AND and OR logic in the if clause itself. If you needed all three ranges to be true before you executed your code you...
    See more | Go to post

    Leave a comment:


  • Without seeing your code it is difficult to reply.

    However in general there are two methods to do this.

    The first is to include a WHERE clause in the ADODC select statement that only causes it to select the records you want. You can do this programatically by buiding the SQL code and then setting the ADODC command to it. This an example of buiding the SQL given that you have two tables, TableA and TableB joined on a...
    See more | Go to post

    Leave a comment:


  • Your problem is that you are trying to nest the if statements without an ELSE statement in the if when what you want is a simple set of if statements.

    If you step through the code and ask youself what happens when the first if statement fails you will find that the code will pass to the end if which relates to the first if which is the last end if in the code.

    The rwo possible correct constructs for your code are...
    See more | Go to post

    Leave a comment:


  • Just a minor point.

    I noticed that you are declaring a 2 x 2 array in the declaration

    Dim a(2, 2) As Integer

    This gives 4 elements in the array

    However your loops are defined as from 0 to 2, or 3 values ie 0,1,2

    This means you are referencing 9 elements in the code. I don't know about .net but in VB 6 this will give you an index out of bounds error.

    Your loops...
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to Split database performance question
    Killer

    I don't know of any references on optimising Access across multiple databases.

    However I have come across the same issues as you when integrating multiple large systems and Access has been the best available tol for providing users with front end database acces across them.

    I think given the number & sizes of the databases you are dealing with that you are coming up against the limitations of...
    See more | Go to post

    Leave a comment:


  • Andrew Thackray
    replied to Time Calculation question
    the function you want is Datediff. This calculates the time between two dates in the units specified. the documentation for the function is...
    See more | Go to post

    Leave a comment:


  • Hi Kosmos

    I have been away a few days so was't able to follow this thread.

    In my original post the 'numberfield' was merely used as an example field name, it has no specific significance in SQL.

    You do not need to make the UNION query a make table query as in SQL you can use an existing query in exactly the same way as if it was a table. For example if I have a query called 'Query1' I can create a onther...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...