Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Combo box rowsourcetype VB function does not work in Acc97

Posted on 1998-05-05
9
Medium Priority
?
605 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

610 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