Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function help 1

Status
Not open for further replies.

Darci

IS-IT--Management
Jul 23, 2002
37
0
0
US
Hi,

Can someone help me write a function that takes the id number and returns the name. For instance, I have an ATM table that contains the related bank id. I want to be able to pass the bank id and return the name.

Thanks

Darci

"If you do what you always did, you get what you always got."

Darci
 
Do you want the Name on a Report or Form?

you can do something like this on Command_click

Private Sub Command_Click()
Dim rs As Recordset
Dim SQL As String
Dim strBankID as string
strBankID = ME!BankId
SQL = "SELECT Name FROM ATM where bankid = " strBankID
Set rs = CurrentDb().OpenRecordset(SQL)
Me!Name = rs("Name")
rs.Close
End Sub
 
Create Function ReturnName (@BankId int)
Return Character(50)
AS
Declare @xName Character(50)
Select LName + FName xName from ATM
where bankid = @BankId

Return @xName
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top