Return value of a Frame into an Append Query (1 Viewer)

tinyevil777

Registered User.
Local time
Today, 13:30
Joined
Dec 10, 2010
Messages
137
Good afternoon, hope Christmas and New Year went swimmingly for you all.

I've got an unbound form which on select a Command button, appends the data into a table. This works fine.

However, i've now added an unbound frame into my form, and i'm trying to append the selection in this frame, but it won't. It returns a blank field.

In the query, i'm using...

Code:
Expr1: [Forms]![NewPO]![Frame11]

Where am i going wrong? :confused:

Thanks in advance for your help!

Thomas
 

Mr. B

"Doctor Access"
Local time
Today, 07:30
Joined
May 20, 2009
Messages
1,932
Create a Public Function in a Module to return the value of your frame.

Code:
Public Function GetFrameValue()
GetFrameValue = Forms!NewPO!Frame11
End Function

Then in your query use:
Code:
Expr1: GetFrameValue()
 

tinyevil777

Registered User.
Local time
Today, 13:30
Joined
Dec 10, 2010
Messages
137
When i try to run the query, it returns a 'Undefined function in 'GetFrameValue' in expression' message.

Have i missed a trick?
 

Mr. B

"Doctor Access"
Local time
Today, 07:30
Joined
May 20, 2009
Messages
1,932
The function must be created in a Module, not in the form module and must be defined as public.

That is really all there is to it.
 

tinyevil777

Registered User.
Local time
Today, 13:30
Joined
Dec 10, 2010
Messages
137
The function is definitely in it's own Module, and not in a form module.

Please see the images attached to demonstrate this issue.

Any further help would be greatly appreciated!
 

Attachments

  • images.zip
    63.4 KB · Views: 82

Mr. B

"Doctor Access"
Local time
Today, 07:30
Joined
May 20, 2009
Messages
1,932
You need to rename your module. You cannot have the module named the same as the function.
 

tinyevil777

Registered User.
Local time
Today, 13:30
Joined
Dec 10, 2010
Messages
137
Ah, didn't realise that. That's cracked it, thanks alot for your help!
 

missinglinq

AWF VIP
Local time
Today, 08:30
Joined
Jun 20, 2003
Messages
6,423
The function is definitely in it's own Module, and not in a form module.
Two questions:

1) What is the name of the Module that the GetFrameValue() resides in? It cannot be the same as the Function because this upsets the Access Gnomes no end and causes them to throw all kinds of errors.

2) What in the world is a programmer in Wales doing writing code for the Norfolk Naval Shipyards, assuming that this is the NNS in Norfolk, Virginia?

Linq ;0)>
 

tinyevil777

Registered User.
Local time
Today, 13:30
Joined
Dec 10, 2010
Messages
137
1) What is the name of the Module that the GetFrameValue() resides in? It cannot be the same as the Function because this upsets the Access Gnomes no end and causes them to throw all kinds of errors.

I named the module the same as the function, that was the problem, i wasn't aware of that fact! Will learn from my mistakes!

2) What in the world is a programmer in Wales doing writing code for the Norfolk Naval Shipyards, assuming that this is the NNS in Norfolk, Virginia?

I must be having a moment of blissful ignorance... enlighten me? ;)
 

Users who are viewing this thread

Top Bottom