Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VBA Code help

Status
Not open for further replies.

osx99

Technical User
Apr 9, 2003
250
GB
Hello,

I have an access database which the following code works fine.

If ([Package] = 1 And [Structure] = 9) Then
[New Con].Visible = True
[Structure construction type].Visible = True
[Existing Deck].Visible = True
[Existing Support].Visible = True
'Me![Repair Type] = 76
'Me![Measure Dimension] = DLookup("[Measure Dimension]", "[Repair Type]", "[Repair Type] = 76")
End If

However, when I add

Me![Repair Type] = 76
Me![Measure Dimension] = DLookup("[Measure Dimension]", "[Repair Type]", "[Repair Type] = 76")

I get the following error

Run-time error '2115' - The macro or function set to the BeforeUpdate or Validation Rule property is preventing Access saving the data in the field.

There is no validation rule and the code runs with no problem in other parts of my code?

Can anyone help?

Thanks,
osx
 
eh, firstly, why are your syntax different for these 2 controls? i.e. before you don't use the Me!...

what is the format of the Repair Type? Number/Text?


Procrastinate Now!
 
As neither of the two lines of code depend on each other - comment ONE out at a time and find out which one is causing the problem.


Infact which line the the debuggur stop on ?


( I suspect, the answer to DanJR's question will lead us to the answer too. )



'ope-that-'elps.

G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top