Solved

Combo box rowsourcetype VB function does not work in Acc97

Posted on 1998-05-05
9
548 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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