PC Review


Reply
Thread Tools Rate Thread

creating general function

 
 
abkad
Guest
Posts: n/a
 
      1st Mar 2009
Hi every body,
I want to creat general function on my access project. it is called Dtable
(n). I will used it through one of my qeuries as Dtable ([table]![column]).
but when i run query
it is promp to required data. How can i reference my function to varaible
data access table
--
ab
 
Reply With Quote
 
 
 
 
Michel Walsh
Guest
Posts: n/a
 
      2nd Mar 2009
You must use Jet (not MS SQL Server).

You must use Access (not VB6, not Dot.Net, not Excel, ... )

The function must be in a standard module, NOT a class, form, report.

The function must be public (not private).

In the query, the argument of your function must exists. The following
statement:

SELECT tableName.ColumnName FROM tableName

should work, so, then, you can use

SELECT tableName.ColumnName, DTable(tableName.ColumnName) FROM
tableName





Vanderghast, Access MVP


"abkad" <(E-Mail Removed)> wrote in message
news:6E38C1F5-C3D0-4CE2-BA3F-(E-Mail Removed)...
> Hi every body,
> I want to creat general function on my access project. it is called Dtable
> (n). I will used it through one of my qeuries as Dtable
> ([table]![column]).
> but when i run query
> it is promp to required data. How can i reference my function to varaible
> data access table
> --
> ab



 
Reply With Quote
 
abkad
Guest
Posts: n/a
 
      2nd Mar 2009
Ii want my function to be used in any access project not a particular one, so
i don't want to specify tablename or column name on the function. i want them
to be as variables and identify them on query like this Dtable ([table
name]![column name])
this how i wrote function on data base
--
ab


"Michel Walsh" wrote:

> You must use Jet (not MS SQL Server).
>
> You must use Access (not VB6, not Dot.Net, not Excel, ... )
>
> The function must be in a standard module, NOT a class, form, report.
>
> The function must be public (not private).
>
> In the query, the argument of your function must exists. The following
> statement:
>
> SELECT tableName.ColumnName FROM tableName
>
> should work, so, then, you can use
>
> SELECT tableName.ColumnName, DTable(tableName.ColumnName) FROM
> tableName
>
>
>
>
>
> Vanderghast, Access MVP
>
>
> "abkad" <(E-Mail Removed)> wrote in message
> news:6E38C1F5-C3D0-4CE2-BA3F-(E-Mail Removed)...
> > Hi every body,
> > I want to creat general function on my access project. it is called Dtable
> > (n). I will used it through one of my qeuries as Dtable
> > ([table]![column]).
> > but when i run query
> > it is promp to required data. How can i reference my function to varaible
> > data access table
> > --
> > ab

>
>
>

 
Reply With Quote
 
Michel Walsh
Guest
Posts: n/a
 
      2nd Mar 2009
Your function only sees an argument, a VARIANT, probably (to handle null),
NOT A TABLE :

=============
Public Function DTable( argName AS Variant) AS Variant
...
...
...

DTable = ...

End Function
============


IN YOUR QUERY, NOT in your function definition, you use

===========
SELECT ... , DTable(tableName.ColumnName) , .... FROM tableName
===========

which has the effect to match the value in the said table, said column, to
the scalar value defined in your function definition.


BUT AGAIN, tableName.ColumnName must be reachable by your query, ie:

==========
SELECT tableName.ColumnName FROM tableName
==========


have to work, else, SELECT ..., DTable(tableName.ColumnName), ... FROM
tableName won't work either, because then the query would not be able to
'reach' the value to be send to the function, in the first place. The
problem won't be the function, in such case. BE SURE the query can reach the
value that will be used in your function, by using it in a query WITHOUT
using the function at all, exactly as in the last SQL statement I typed. I
repeat myself, THAT simple statement has to work, and you have to be sure it
works, without adding a call to your function.



Vanderghast, Access MVP



"abkad" <(E-Mail Removed)> wrote in message
news:3F256F99-41B4-425C-86A7-(E-Mail Removed)...
> Ii want my function to be used in any access project not a particular one,
> so
> i don't want to specify tablename or column name on the function. i want
> them
> to be as variables and identify them on query like this Dtable ([table
> name]![column name])
> this how i wrote function on data base
> --
> ab
>
>
> "Michel Walsh" wrote:
>
>> You must use Jet (not MS SQL Server).
>>
>> You must use Access (not VB6, not Dot.Net, not Excel, ... )
>>
>> The function must be in a standard module, NOT a class, form, report.
>>
>> The function must be public (not private).
>>
>> In the query, the argument of your function must exists. The following
>> statement:
>>
>> SELECT tableName.ColumnName FROM tableName
>>
>> should work, so, then, you can use
>>
>> SELECT tableName.ColumnName, DTable(tableName.ColumnName) FROM
>> tableName
>>
>>
>>
>>
>>
>> Vanderghast, Access MVP
>>
>>
>> "abkad" <(E-Mail Removed)> wrote in message
>> news:6E38C1F5-C3D0-4CE2-BA3F-(E-Mail Removed)...
>> > Hi every body,
>> > I want to creat general function on my access project. it is called
>> > Dtable
>> > (n). I will used it through one of my qeuries as Dtable
>> > ([table]![column]).
>> > but when i run query
>> > it is promp to required data. How can i reference my function to
>> > varaible
>> > data access table
>> > --
>> > ab

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a General Inbox Justin Louie Microsoft Outlook Discussion 1 7th Dec 2009 07:49 PM
Creating a General Log / Journal Ken Curtis Microsoft Access 2 14th Sep 2008 10:46 PM
Creating general rule in Outlook Dave Neve Microsoft Outlook Discussion 3 10th Apr 2006 03:30 AM
Creating forms - general ? =?Utf-8?B?QnJpYW4=?= Microsoft Access Getting Started 2 10th Jun 2005 12:46 PM
creating a general input form =?Utf-8?B?Y2Ftcm9uMTA3?= Microsoft Excel Worksheet Functions 0 1st Jul 2004 04:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:51 PM.