Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2007, 04:05 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default Run code in Macro

I am trying to create a macro that will run
this code by using Runcode action.


The code is show below. What do I need to do to make this work.

#CODE#
Public Function SepData()
Dim rst As Recordset
Dim db As Database
Dim i As Long
Dim MySeparator() As String
Dim fld As String
Set rst = CurrentDb.OpenRecordset("tblSymantece-mailSplit", dbOpenTable)
With rst
    Do Until .EOF
        MySeparator = Split(rst.Fields("Notes_Move").Value, "&")
        .Edit
        For i = 0 To UBound(MySeparator)
        fld = "column" & i
        .Fields(fld).Value = MySeparator(i)
        Next i
        .Update
        .MoveNext
        Loop
        End With
        rst.Close
        Set rst = Nothing
        End Function
#END CODE#
Thanks

Corey

 
Old January 26th, 2007, 04:37 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Create a new macro
select RunCode as the action
enter SepData() at the bottom beside where it says function

 
Old January 29th, 2007, 02:38 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Don't use # for comments. Use '

## means the item is a date in VBA.

mmcdonal
 
Old February 5th, 2007, 10:41 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default

ok, sorry

 
Old February 5th, 2007, 10:54 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Oh, I was just saying that in case it was causing problems in your code.


mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to run macro from another workbook? rmilward Excel VBA 2 September 26th, 2009 08:00 PM
How do i run Macro on Web virall23@yahoo.com Excel VBA 2 April 17th, 2008 01:04 AM
run a macro at a certain date s_gh Excel VBA 4 May 17th, 2006 06:34 AM
run macro from asp aspuser27 Excel VBA 3 January 28th, 2005 04:30 AM
Macro Doesn't Run? CoryKutchera Excel VBA 3 January 5th, 2005 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.