using a function to do frequent tasks

G

Guest

In some code I'm working on I need to do a frequent check on a string so I
send it to a function to do the check.
However, what I'm checking is refering to the contact item I have open, but
in the seperate function it doesn't recognize that. How should I be doing
what I'm trying to do:
Dim rs1 As DAO.Recordset
Set rs1 = CurrentDb.OpenRecordset("Name")
....
MyString=CheckPhone(rs1!Phone)
....


end sub

Function CheckPhone(strPhone as String) as String
....
....here I try to access something like rs1!Name but it doesn't recognize it.
Is there a way to make this stuff global or something?
....


end Function
 
J

John W. Vinson

Dim rs1 As DAO.Recordset
Set rs1 = CurrentDb.OpenRecordset("Name")
...
MyString=CheckPhone(rs1!Phone)
...


end sub

Function CheckPhone(strPhone as String) as String
...
...here I try to access something like rs1!Name but it doesn't recognize it.
Is there a way to make this stuff global or something?
...

strPhone is *just a string* - something like "415-555-1212". The CheckPhone
subroutine knows absolutely nothing about recordsets or how it was called.

Could you explain what you WANT CheckPhone to do? Why does it need to know
anything about the recordset?

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top