Results 1 to 7 of 7
  1. #1
    jdftwrth99 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Location
    Texas
    Posts
    2

    Can anyone help me with an Access Visual Basic routine from 1993

    Hi

    I had written a number of visual basic scripts a long time ago and now have a need to dust a couple of them off and bring them up to a level that will work with Access 2010, problem is that I really am lost, i have provided a snippet of one of the old scripts can anyone tell me what changes to make so they will run under Access 2010?



    Thanks

    JD

    VBOne.txt

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Never used it but apparently the OpenTable method is still good. http://msdn.microsoft.com/en-us/library/ff194975.aspx

    Test it, debug. Refer to link at bottom of my post for tutorial on debug techniques.

    A quick simple way to update fields of a table uses SQL. Maybe SQL wasn't available to Access in 1993? That entire procedure could be replaced with one line.

    CurrentDb.Execute "UPDATE tablename SET field1='Yes'"

    Is field1 a text or Yes/No type? If Yes/No:
    CurrentDb.Execute "UPDATE tablename SET field1=-1"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jdftwrth99 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Location
    Texas
    Posts
    2
    How would you handle that with multiple conditions to be met and resulting in multiple fields being updated?

    Next, Are there any programming manuals for Access 2910 Visual Basic? I have my manuals from 1993 but they are pretty much desk ornaments now.

    JD

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    When I was new to VBA programming I used references for VB6. I bought several used books from Amazon. Haven't actually cracked them open lately.

    One reference I reviewed that looks good is:
    Access™ 2007 Programming by Example with VBA, XML, and ASP by Julitta Korol, Wordware Publishing, Inc.

    Generic example of UPDATE sql syntax:
    UPDATE tablename SET field1=value1, field2=value2 WHERE criteria here

    A good source to learn basic SQL http://www.w3schools.com/sql/default.asp

    Can also use the Access query designer Design View grid to build some queries then view the SQL statement in the designer's SQL View or type them directly into the SQL View - some queries can be built only by typing, such as UNION.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Are there any programming manuals for Access 2910 Visual Basic?
    You would need to look for VBA programming.




    BTW, in looking at your code,
    Code:
        If Not ErrorCondition Then
    ErrorCondition is ALWAYS zero because in your error handlers, you have

    Code:
    Error_Condition = True
    Note the underscore....


    In this code snippet, you will always be on the same record. You would need to add a MoveNext command (in Blue).
    Code:
                Do Until MyTable.EOF
                
                    If MyTable.Field1 = "No" Then
                        
                        MyTable.Edit
                        MyTable.Field1 = "Yes"
                        MyTable.Update
    
                        MyTable.MoveNext
    
                    End If
                Loop

  6. #6
    cplmckenzie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    25
    Microsoft provide free manual - tutorials -examples online for all their products.

    Start here and search?

    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

    cplmckenzie

  7. #7
    cplmckenzie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    25
    For Access 2010 go here...

    http://msdn.microsoft.com/en-us/library/ee861519.aspx

    cplmckenzie

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using Access Instead of Visual Basic
    By dinz in forum Programming
    Replies: 2
    Last Post: 12-19-2019, 10:33 AM
  2. Converting Access to Visual Basic
    By Juicejam in forum Access
    Replies: 3
    Last Post: 04-12-2012, 02:39 AM
  3. Visual Basic
    By kwooten in forum Queries
    Replies: 2
    Last Post: 01-25-2012, 08:22 AM
  4. how to use visual basic in access
    By learning_graccess in forum Access
    Replies: 3
    Last Post: 12-05-2011, 03:23 PM
  5. Record Value in Visual Basic
    By chrismec in forum Programming
    Replies: 3
    Last Post: 12-09-2009, 04:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums