开发者

In VBA/Access get value from current record when changing records

I have an Access database. I have a map control embedded in a form (using MapInfo, but that's not important). When a user goes from one record to another I would like the map to re-centre on the appropriate coordinates. To do this I need to get the coordinates which are stored in the current row of the table which is the data source for the form. My question is how I access this value. This is pretty simple, right?

I have worked out that the "On Current" event is triggered when the record is changed but I can't seem to refer to the xcoord and ycoord fields in the current row.

This page seems to suggest that I need to create a module to do this. Surely there's a simpler way?开发者_开发问答

Thanks in advance!

Update: If I put a pair of textbox controls in the form that display the x and y coordinates then I can access them by doing Me.x_coord. Is this the answer?


In Access VBA you can reference the fields of a bound form's recordsource with the syntax:

Forms!your_form_name!your_field_name

In your case, you can grab the current x_coord with Me!x_coord. No need to bind it to a control to get the data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜