473,383 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

What should I pass into this Function?


Hi All,

The error I am getting is 3265:
"Item not found in this collection."

How should I be passing in the vReturnFieldName so it will be recognized as
a value in the collection?
Thanks for your assistance.

Information:
I pass four variables to the FindNameString function and want it to return
the value of field:
strProjectPrime in table 'Project Primes"

The table "Project Primes" has two fields
lngProjectPrimeID and strProjectPrime

Private Sub TestRun()
MsgBox FindNameString("Project Primes", "lngProjectPrimeID",
"strProjectPrime", 21)
End Sub

Public Function FindNameString(vTblName As String, vFindFieldName As String,
_
vReturnFieldName As String, vFindFieldValue As Long) As String
On Error GoTo FindNameString_Error

Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset(vTblName, dbOpenSnapshot)
If rs.RecordCount > 0 Then
rs.FindFirst "[" & vFindFieldName & "]=" & vFindFieldValue
If rs.NoMatch = False Then
FindNameString = rs![vReturnFieldName] 'rs![ProjectPrime]
Else
FindNameString = 0
End If

End If
rs.Close
Set rs = Nothing

On Error GoTo 0
Exit Function

FindNameString_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
FindNameString of Module Conversion"

End Function


Nov 13 '05 #1
2 1175
Barry Wright wrote:
Hi All,

The error I am getting is 3265:
"Item not found in this collection."

How should I be passing in the vReturnFieldName so it will be recognized as a value in the collection?
Thanks for your assistance.


When I pasted your code into Access, the vTblName just before
dbOpenSnapshot came in as vTblNa-me. When I removed the hyphen and
used rs(vReturnFieldName) instead of rs![vReturnFieldName] it worked.

James A. Fortune

Nov 13 '05 #2

Indeed it did work!
Fantastic James and thank you!

Barry

<ji********@compumarc.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Barry Wright wrote:
Hi All,

The error I am getting is 3265:
"Item not found in this collection."

How should I be passing in the vReturnFieldName so it will be

recognized as
a value in the collection?
Thanks for your assistance.


When I pasted your code into Access, the vTblName just before
dbOpenSnapshot came in as vTblNa-me. When I removed the hyphen and
used rs(vReturnFieldName) instead of rs![vReturnFieldName] it worked.

James A. Fortune

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Sam | last post by:
Hi I'm learning to code with C++ and wrote some very simple code. I think it's consistent with every rule but always got compiling errors that I don't understand. The code include 5 files as...
41
by: Berk Birand | last post by:
Hi, I am just learning about the array/pointer duality in C/C++. I couldn't help wondering, is there a way to pass an array by value? It seems like the only way to do is to pass it by...
0
by: Zlatko Matiæ | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
8
by: QQ | last post by:
SpreadsheetCell(const string& initialValue); I don't understand what & means here? Thank you very much! A C++ beginner
16
by: Martin Jørgensen | last post by:
Hi, Problem: ======== Some of my output functions are beginning to take pretty many arguments... I mean.... We're talking about 10-15 arguments :-) So I thought to myself, perhaps this is...
50
by: LaundroMat | last post by:
Suppose I have this function: def f(var=1): return var*2 What value do I have to pass to f() if I want it to evaluate var to 1? I know that f() will return 2, but what if I absolutely want to...
10
arunmib
by: arunmib | last post by:
hi all, I just got this freaky kind of doubt....I have the following piece of code, int main() { int Val= 10, *ptr; ptr = &Val; TestFn(&Val);
36
by: Pat | last post by:
Hi, I've run into a strange problem, but one that seems like it might be fairly common. I have a single base class, from which several other classes are derived. To keep the example simple,...
9
by: Trent | last post by:
Here is the error while using Visual Studio 2005 Error 1 error LNK2019: unresolved external symbol "void __cdecl print(int,int,int,int,int,int,int,int)" (?print@@YAXHHHHHHHH@Z) referenced in...
11
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.