Hi, that is basically my question there in the title
If someone knows..
Assuming you're doing this way it's usually done, with a delimiting character between each item you're passing, you could do this: - Dim vars As Integer
-
-
If Not IsNull(Me.OpenArgs) Then
-
-
If InStr(Me.OpenArgs, ";") = 0 Then
-
vars = 1
-
Else
-
vars = Len(Me.OpenArgs) - Len(Replace(Me.OpenArgs, ";", "")) + 1
-
End If
-
-
End If
This assumes you're using a semi-colon as the delimiting character. You can modify for another character, if need be.
Welcome to Bytes!
Linq ;0)> 14 2934
The OpenArgs property of a form/report is just a string which value is set by (usually) using a DoCmd.OpenForm/OpenReport command. It can contain multiple variables in the string, if that's what you place there. Parsing those variables out can be done with custom functions, or maybe even the Split() command.
You'll need to be a lot more detailed with your questions if you want any further help.
Thanks for replying, Megalog
Sorry if i wasn't clear, but i wasn't asking how the OpenArgs works, i know how to use it. My question was, presuming i already used it and passed several variables, once i 'catch' this OpenArgs string - is there a way to know how many variables were passed in it originally (=how many variables does openargs contain).
It's not that important, i just wanted to know if it can be done...
OpenArgs is a temporary variable, that as far as I know, is only stored in memory while that form is open. There is no history to it, etc. You're able to play with whatever data is currently in there at that moment, that's it. So, there is only 1 variable at any time.
@TravelingCat
Like Megalog stated, the OpenArgs parameter is a single string variable that is passed to the form or report. If you are passing multiple values through it, then you must be combining those values into a string. The method you use to determine how many values it contains depends entirely on the method you used to combine them in the first place.
If you want to post the code you used to pass the values, I'm sure someone can show you a way to count the values OpenArgs contains. Without seeing the calling code though, there isn't anything more to be said.
Assuming you're doing this way it's usually done, with a delimiting character between each item you're passing, you could do this: - Dim vars As Integer
-
-
If Not IsNull(Me.OpenArgs) Then
-
-
If InStr(Me.OpenArgs, ";") = 0 Then
-
vars = 1
-
Else
-
vars = Len(Me.OpenArgs) - Len(Replace(Me.OpenArgs, ";", "")) + 1
-
End If
-
-
End If
This assumes you're using a semi-colon as the delimiting character. You can modify for another character, if need be.
Welcome to Bytes!
Linq ;0)>
missinglinq, thanks a lot, that is exactly what i needed:) Indeed i used ";" as a delimiter, so the code does what i asked for.
Thanks for other replies also
You can simply use the Split command for the OpenArgs value which will assign the results to an array (0 based). You can then use the UBound command to figure out the number of variables. - Dim astrValues() As String
-
If Not IsNull(Me.OpenArgs) Then
-
astrValues = Split(Me.OpenArgs, ";")
-
intVars = UBound(astrValues) + 1
-
End If
The following Function, in a Form Module will return either the Number of Arguments passed, NULL, or a Descriptive Error Message. - Private Function fNumberOfArgs() As Variant
-
On Error GoTo Err_fNumberOfArgs
-
-
fNumberOfArgs = UBound(Split(Me.OpenArgs, ";")) + 1
-
-
Exit_fNumberOfArgs:
-
Exit Function
-
-
Err_fNumberOfArgs:
-
If Err.Number = 94 Then 'No OpenArgs
-
fNumberOfArgs = Null
-
Else
-
MsgBox Err.Description, vbExclamation, "Error in fNumberOfArgs()"
-
Resume Exit_fNumberOfArgs
-
End If
-
Resume Exit_fNumberOfArgs
-
End Function
NeoPa 32,556
Expert Mod 16PB TravelingCat: Hi, that is basically my question there in the title
If someone knows..
It is clearly important in this case to explain that you are passing multiple items across as a delimited string. I'm sure it saved you some time not including that info, but it's equally clear that it took up the time of various others trying to help you, to work out what you should have made clear in your question in the first place. Please try to be more specific with your questions in future.
Administrator.
NeoPa, i assure you that i did not NOT mention it because i was trying to save time, but of sheer belief that the question was clear. But i explained myself immediately after the first reply, so again, sorry for vagueness.
NeoPa 32,556
Expert Mod 16PB
If you're happy you did the best you could in the circumstances then I'm happy.
In truth, clear communication is difficult at the best of times, which is why I try to encourage care wherever possible.
And i agree with you. But in this case, it seems like you are a little bit too hursh on me.
I suggest we leave it at that.
NeoPa 32,556
Expert Mod 16PB
Funny is a great quality, i'll take it
Sign in to post your reply or Sign up for a free account.
Similar topics
by: G-Factor |
last post by:
Hi all
Been learning C++ for about 5 weeks. I find that I create quite a lot of
variables. Generally, is it better to create a new variable for every
different thing that needs to be stored in...
|
by: Arjen |
last post by:
What does this mean?
'Roles' does not contain a definition for 'RoleExists'
I'm doing this:
using System.Web.Security;
Roles.DeleteRole(txtRolename.Text.Trim());
I don't see what's wrong.
...
|
by: ohayo |
last post by:
In a windows form app (which acts as a front end to my quickfix
application), I get the following error on compiling
Application does not contain a definition for 'Run'.
What does this mean,...
|
by: ssims |
last post by:
I've got this code for a random GDI+ chart generator, and the demo
works, but when I try to run it on my local machine I get a compiler
error: Compiler Error Message: CS0117: 'Random' does not...
|
by: jobs |
last post by:
CommandArgument does not contain row index when command under
Templatefield of- Gridview
It appears CommandArgument passed to the rowcommand event does not
contain row index when the command is...
|
by: J Miro |
last post by:
When I call the Generic method ShowName in the following code, I get the
error message "'T' does not contain a definition for 'Name'." Does anyone
know why? Thanks in advance. Jay.
...
|
by: =?Utf-8?B?V2FsaWQ=?= |
last post by:
Hello:
I have migrated a site from IIS5 to IIS6. The site is configured and the we
app is installed on the new IIS site. I can get to the web page but when I
try to login, this is what I get...
|
by: cephal0n |
last post by:
Hi All!
I have a field named: Title,now I want to filter the data with a specific match.
In Excel when you set the whole sheet1 to data>filter>autofilter, excel offers an Custom AutoFilter...
|
by: HarishAdea |
last post by:
Hi,
I am trying to run the JAVA pgm, but it is giving error as "selection does not contain a main type".
The filename is "ScoreLeadSummary.java" when i try to run it or debug,it gives the pop...
|
by: boss32178 |
last post by:
Ok I get this error when i try to run the web app.
foreach statement cannot operte on variables of type 'object' does not contain a public definition for 'GetEnumerator'
here is the code
#region...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |