Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Combo box rowsourcetype VB function does not work in Acc97

Posted on 1998-05-05
9
Medium Priority
?
612 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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
 
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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have had my own IT business for a very long time. I started mostly with hardware and after about a year started to notice a common theme. I had shelves with software boxes -- Peachtree, Quicken, Sage, Ouickbooks -- and yet most of my clients were…
A Case Study of using the Windows API to provide RS232 communications capability in Access without the use of Active-X controls.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

571 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