Hello Andre,
If I understand you correctly, the same code works fine in a test database, but it does not work
in your current database. This observation suggests the possibility of some type of corruption,
perhaps in the form itself.
The first thing I would do, if you haven't already done so, is a complete shutdown of your PC and
re-boot (ie. cold boot). Sometimes weird behavior can be cleared by simply rebooting the PC. I
recommend the cold boot method as opposed to a warm boot. If the problem still persists, then
make a back-up copy of your database (you should have a recent one anyways) and use the
undocumented /decompile switch to open the database. Then try compacting your database and
re-compiling the code.
If that does not work, then try creating a brand new database and import each group of objects
(tables, queries, forms, reports, macros, modules and data access pages) one group at a time.
Although Access will allow you to import all objects in one operation, the experts at FMS have
previously posted their opinion that recommends importing only one group at a time. Make sure to
set the references in the visual basic editor (Tools > References) to match those of the source
database, and then attempt to compile the code. You'll also need to reset any start-up options,
since these will not be imported.
Tom
_________________________________
Hi.
i have the same problem, but i didnt link any word document to the database.
i have tried all the 3 methods i read in tha article, but didnt work.
The problem started when i wrote a procedure in VBasic in an afterupdate of
one field in a subform. (ill write all the code bottom), and only apears when
i write in that field. Im desperating!!! i have tried to put the same code in
a basic test database i created specificly to test if the code was correct,
and it worked fine!
hahe u any idea of what is the problem?
Here is the code:
Option Compare Database
Private Sub alt_AfterUpdate()
If Forms![doentes]![sexo] = 1 And [alt] >= 0 And [alt] <= 41 Then
With CodeContextObject
.[grau ALT] = "normal"
End With
End If
If Forms![doentes]![sexo] = 1 And [alt] >= 42 And [alt] <= 82 Then
With CodeContextObject
.[grau ALT] = "grau 0"
End With
End If
If Forms![doentes]![sexo] = 1 And [alt] >= 83 And [alt] <= 144.5 Then
With CodeContextObject
.[grau ALT] = "grau 1"
End With
End If
If Forms![doentes]![sexo] = 1 And [alt] >= 144.5 And [alt] <= 289 Then
With CodeContextObject
.[grau ALT] = "grau 2"
End With
End If
If Forms![doentes]![sexo] = 1 And [alt] >= 290 And [alt] <= 578 Then
With CodeContextObject
.[grau ALT] = "grau 3"
End With
End If
If Forms![doentes]![sexo] = 1 And [alt] >= 579 Then
With CodeContextObject
.[grau ALT] = "grau 4"
End With
End If
If Forms![doentes]![sexo] = 0 And [alt] >= 0 And [alt] <= 31 Then
With CodeContextObject
.[grau ALT] = "normal"
End With
End If
If Forms![doentes]![sexo] = 0 And [alt] >= 32 And [alt] <= 62 Then
With CodeContextObject
.[grau ALT] = "grau 0"
End With
End If
If Forms![doentes]![sexo] = 0 And [alt] >= 62 And [alt] <= 108.5 Then
With CodeContextObject
.[grau ALT] = "grau 1"
End With
End If
If Forms![doentes]![sexo] = 0 And [alt] > 108.5 And [alt] <= 217 Then
With CodeContextObject
.[grau ALT] = "grau 2"
End With
End If
If Forms![doentes]![sexo] = 0 And [alt] > 217 And [alt] <= 434 Then
With CodeContextObject
.[grau ALT] = "grau 3"
End With
End If
If Forms![doentes]![sexo] = 0 And [alt] >= 434 Then
With CodeContextObject
.[grau ALT] = "grau 4"
End With
End If
End Sub