OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Set variable to the value in a field

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
smaclee
Newbie
Newbie


Joined: 10 Sep 2010
Posts: 2

PostPosted: Fri Sep 10, 2010 9:08 pm    Post subject: Set variable to the value in a field Reply with quote

I have what I thought was a basic question, but can not find an answer.

I need to set a variable "row" to equal the existing content of a field shown on a form. The form is called "Main_menu" and the form field is called "Entrynofield".

I have declared row with:
Dim row = Integer

(because Entrynofield refers to a table field that is stored as a number)

However can not seem to set row to equal the value held in this field. Can anyone please help? Been trying for so long this is getting kinda urgent for me unfortunately.

Thanks in advance
Back to top
View user's profile Send private message
cilt
Power User
Power User


Joined: 20 May 2010
Posts: 89

PostPosted: Sun Sep 12, 2010 4:59 pm    Post subject: Reply with quote

thiswhat you looking for?
it assumes that the sub is being run from the form which contains the field

Code:

sub getrow
 Dim Doc As Object
 Dim Forms As Object
 Dim Form As Object
 Dim Ctl As Object
 dim row as integer
 Doc = ThisComponent
 Forms = Doc.Drawpage.Forms
 Form = Forms.GetbyIndex(0)
 Ctl = Form.GetbyName("Entrynofield")
 row = Ctl.CurrentValue
msgbox row
end sub
Back to top
View user's profile Send private message
smaclee
Newbie
Newbie


Joined: 10 Sep 2010
Posts: 2

PostPosted: Mon Sep 13, 2010 2:21 am    Post subject: Reply with quote

Looks good, thanks heaps.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group