Unresponsive form

darry

New member
Local time
Today, 08:14
Joined
Oct 16, 2008
Messages
7
i hope soemone can help

i have a form where VB doesnt respond in places. Generally the code of theform works but when it come to a reference to a public function it does not call it and returns error message ""

The same public functions works on all other forms in the same project. Also when typing the reference in any other form you get the auto prompts, but when trying the same code on the dead form, no auto prompts at all !!?

What is going on??

i have tried rebuilding / export / importing for to new DB /Current Db etc etc, but still seems dead!

many thanks
 
I have spent most of afternoon trying this but it does not seem to have the effects that the article suggests

any further ideas?
 
a) have you got the same function declared in more than one place - it will use a function in a forms module, rather than use a general code module

b) put a breakpoint immediately before the code you want to follow
-click in the left margin, you will get a brown dot. when you run the code it will pause at that point, then press F8 to step through the code a line at a time


then you can see exactly what is happening
 
Thanks Gemma,

I have checked the form and the function is only defined once elswhere. (other forms refereto it in this place so at least this appears to work)

Following the code through fubtcion returns "type mismatch". The form is not reading something properly or is mis-referencing something -just a question of how to clear it / reset it to refer to the right place.

The code to this point works - ie variables are shown on cursor - but the reference shows type mismatch

any ideas? Thanks
 
Type mismatch is given usually when you try to compare different types of data.

I.E. you try adding a string to an integer or something like that.
 
Exactly.

The identical code works on other forms in the same project.

So type mismatch is not the correct answer although access is struggling with something on the reference n this particular form. I ahev also tried changing the item to integer/string/date but this does not change anything

it really is a tricky one!

Thanks
 
Maybe post your code so others can see what is going on?
 
Code is as follows;

Firstly module;

Public Function twhen(timein As Date) As Integer

If Val(Format(timein, "h")) >= 13 Then
twhen = 1 ' "afternoon"
Else
twhen = 2 '"morning"
End If

End Function

Secondly SubRoutine behind Form ( part of larger sequence)

.......

Dim AmPM As String

AmPM = twhen(Date)
.....
AmPm should return with value of 1 or 2

when the cursor is held over the code as it runs the AmPM string shows as "", (now) show as now, ie date time which are both correct but the cursor over twhen shows as 'twhen(now) = <type mismatch>'

excatly the same code works on other forms unless i am being really stupid - which is quite likely . A couple of us here are quite experienced and cant fathom it.

Despite The fact that AmPm is a string still returns the string value of 1 or 2 on other forms with the identical code.

tell me what you think!
 
Dim AmPM As String

AmPM = twhen(Date)

you have set ampm as string,
but twhen is returning a number (integer)

thats your type mismatch
 
hi gemma,

i wish it was the case.

what i have shown is the last version i have tried to solve it. I have tried defining AmPm as integer but nothing.

also code as shown works on other forms. AmPm string ends up with a value.

I have a feeling that the mismatch is somewhere due to a corruption in the form itself, It acts in a strange manner - ie autoprompts dont show up when writing code - only on this form tho.

The form also works in old er back versions and i have tried importing this form again but no luck
 
I wondeer if the form is partially corrupt. it shows in the project window but does not display on the task bar

almost as if it is invisible or not fully recognised

any suggestions how to check for curruption in a form. Most of the code works but just this section fails. Anything to do with SaveNameFAilure?
 

Users who are viewing this thread

Back
Top Bottom