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 April 11th, 2006, 08:36 AM
Authorized User
 
Join Date: Apr 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default OpenArgs Question

Hi all,

I've used OpenArgs before to pass information through to another form, now the problem I'm comming up against is a way to pass more than one value and how to retrive each of those values in separate variables.

Now, I've taken a look around the net and in a couple of books I've got and can't seem to find any confirmation as to whether or not I can do the above. Does anyone have an idea of if this is possible or not?

Apologies if some of these questions seem a little...simple, but this is the first time I've actually had to program Access heh.

Regards,
LiamBFC
__________________
Liam Gulliver,
http://p2p.neopian-hosting.com
A New Programming Chat Forum
 
Old April 13th, 2006, 04:18 AM
Authorized User
 
Join Date: Feb 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, not sure if what I am recommending are good methods, but you may want to try the following

Method 1:
Pass the values that you want to store into a public collection object. Then retrieve the items from the collection object.

Method 2:
Concatenate the argument into a string seperated by a delimiter such as ";" or "-". For example, if you want to pass 3 strings "A", "B", "C" to the next form,

Dim strArgs as String
strArgs = "A;B;C;"

Pass strArgs as the OpenArgs.
Then, write a short function to break up the string into the components that you need.

Method 3:
Use the tags of the various controls (I don't really like using this method)

HTH

Scripts82
 
Old April 13th, 2006, 05:00 AM
Authorized User
 
Join Date: Apr 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll have a go at Method 2 and let you know how it goes :)

 
Old April 17th, 2006, 02:14 AM
Friend of Wrox
 
Join Date: Jul 2005
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To work with your string, check out the JOIN and SPLIT functions.

Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com
 
Old April 18th, 2006, 04:33 AM
Authorized User
 
Join Date: Apr 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorted it with:

Public Function GetTagFromArg(ByVal OpenArgs As String, _
                               ByVal Tag As String) As String
    Dim strArgument() As String
    strArgument = Split(OpenArgs, ":")
    Dim i As Integer
    For i = 0 To UBound(strArgument)
     If InStr(strArgument(i), Tag) And _
                 InStr(strArgument(i), "=") > 0 Then
       GetTagFromArg = Mid$(strArgument(i), _
                        InStr(strArgument(i), "=") + 1)
       Exit Function
     End If
   Next
   GetTagFromArg = ""
End Function






Similar Threads
Thread Thread Starter Forum Replies Last Post
copy fields from Form to new form - openargs justabeginner Access VBA 1 February 4th, 2007 01:28 PM
Question Ashwini Classic ASP Databases 3 January 10th, 2006 07:20 AM
Question Ashwini Classic ASP Databases 1 January 4th, 2006 06:55 AM
OpenArgs to Sub Report mwn1218 Access VBA 12 January 19th, 2005 12:28 PM





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