简体   繁体   中英

VBA macro for reading cell values from linked tables

I have Access application that stores CAD model parameters and connects via VBA macros to CATIA to input that parameters values into real model (CAA Automation)

This is how simplified relations looks: Database relationships

There are different forms for body, part and assembly. In assembly form when there is the same name of parameter in liked tables control source is being named Body.A an Part.A, when different control source is as the name of parameter (B1, D)

definition is made for each lenght

set lenghtX = parametersX.Item("CATIA parameter name") 
'type is lenght, so program CATIA and it's method doesn't matter

so reading and sending values by

lenght1.value = B1
'left side lenght in CATIA
'ride side control source name in MS Access

or

lenght2.value = D

WORKS

but to read from linked (by it's control source name, how it was done in code before)

lenght3.value = Body.A

or

lenght4.value = Part.A

NOT

does anybody now how to get values from linked tables?

As I understand, Body.A and Part.A are names of controls.

While you usually can refer to controls by just stating their name, this doesn't work if they have characters that aren't allowed in a variable name like a dot or aa space.

You can refer to them explicitly through the controls collection.

lenght3.value = Me.Controls("Body.A").Value

I'm not familiar with CAA or CATIA, though, so I might have overlooked something obvious on that part.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM