Solved

Combo box rowsourcetype VB function does not work in Acc97

Posted on 1998-05-05
9
513 Views
Last Modified: 2012-05-04
The Combo box rowsourcetype VB function worked in Acc2.0. When I converted the database to Acc97, the VB function in the rowsourcetype property of a combo box is not invoked at all, even though the help documentation inidicates it should work as it did in Acc2.0.

Has anyone been able to populate a combo box in Acc97 using a VB function in the combo box's rowsourcetype property.

I dont normally populate a combo box this way but I had a special application where it works well in Acc2.0 - so im not after alternative ways of populating a combo box - I just want to know why the VB function method isn't working in Access97.

0
Comment
Question by:ozphil
9 Comments
 
LVL 2

Expert Comment

by:marti
ID: 1963024
May I have a look? Could you please send an example to konst@sprint.ca
0
 
LVL 4

Author Comment

by:ozphil
ID: 1963025
Try this out Marti.

In Access 2, create a form and drtag a combo box into it. Assign any fucntion name say 'MyFunction' to the Row Source Type property. Execute the form. An error occurs because the fucntion does not exist. Create a dummy function 'MyFunction' in a module. Execute the form. An error occurs because no arguments are supplied. This is all CORRECT behaviour.

Now try the same thing in Access 97. What do you get? NO ERROR MESSAGES. The Row source type assignment is COMPLETELY IGNORED by Access97.

Its got me baffled. I cant see anywhere where the combo box is a conversion issue.
0
 
LVL 3

Expert Comment

by:guillems
ID: 1963026
Hi!

  Ozphil I check your question, and when I click to see the list of values of the combo-box it makes an error, So with the error event of the form, you can control this.

I hope this help you!
0
 
LVL 4

Author Comment

by:ozphil
ID: 1963027
Hi Guillems.

Could you read the question again please.

In Access97 the combo box VB function assigned to the combo box Row source Type property does not get invoked.

Is this a Micorsoft bug. Is there a Knowledgebase article on the bug.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Author Comment

by:ozphil
ID: 1963028
Guillems. Dis you get this error message with Access97?
0
 
LVL 5

Accepted Solution

by:
kulikuli earned 100 total points
ID: 1963029
Hi,

I frequently use functions in listboxes and comboboxes as rowsource.
I can remember I once experienced the same problem, because I forgot some little thing to do. I think it might be that you have to put the name of the function in the rowsourcetype property without parentheses and without = .So just the name of the function. This function has to be declared public in a standard module (not in a form's class module).

I just checked it out in one of my applications and it works (in access 97)
Any questions .... tell me.

Best regards,

Kuli
0
 
LVL 4

Author Comment

by:ozphil
ID: 1963030
Thanks kuli kuli.

THere is still a problem here.

You should get a compile error if you name the function in the combo properties to a function name that doesnt exist. Could you do this for me and let me know if you get a compile error. I dont get an error and i should. Access 2 always comes up with an error if you make the slightest mistake. Access 97 shows no errors. It soes not recognise the function.

Something is amiss.




0
 
LVL 4

Author Comment

by:ozphil
ID: 1963031
I have at last got the thing to work.

The problem was with the row and col arguments being declared as integer in Access 2. When I changed the data type to variant in Access97, the function and hence the combo box listing now works.

In Access 2, a syntax error is displayed when the wrong data types are present, but Access 97 presents no error message.

Because you had had success with this I persisted until it worked.

Thanks kulikuli

0
 
LVL 5

Expert Comment

by:kulikuli
ID: 1963032
If you place the name of a not-existing function in the rowsourcetype property of a combobox or listbox and you open the form in normal view then you should get the following message:
'[Functionname]' may not be a valid setting for the RowSourceType property, or there was a compile error in the function.

If you pass a variable to a function, the 'receiving variable' has to be able to receive the passed variable. Passing a long to an integer or vice versa is only possible using ByRef.
In case of passing a long to an integer the long has to be within the range of -32678 to 32767. Otherwise you'll get a compile error.

The intrinsic callback function most apparently has been written in C (most intrinsic functions are stored in a DLL).When the function is called nothing seems wrong because the arguments passed to it are ok. Because it is not part of Access itself, there is no check on the returnvalue that Access receives.
The callback function actually is already compiled (to native code) so it cannot generate a compile error. This is the problem with DLL-functions. You have to know exactly what the function has to receive and what it returns.

Thanx for rewarding me.

Best regards,

Kulikuli
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now