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

x
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Tue May 27, 2008 3:44 am    Post subject: x Reply with quote

xxx

Last edited by Robby on Sun Dec 11, 2011 1:28 am; edited 1 time in total
Back to top
View user's profile Send private message
Voobase
OOo Advocate
OOo Advocate


Joined: 21 Nov 2007
Posts: 400
Location: Australia

PostPosted: Tue May 27, 2008 7:07 am    Post subject: Reply with quote

Hi Robby,

Read the documents by C.Benitez "Forms and Dialogs" and "Database Development". There are some example functions in there. The ones you need to look at are "findFirst" and "Getxxx"

Cheers

Voo

http://www.geocities.com/rbenitez22/
Back to top
View user's profile Send private message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Tue May 27, 2008 7:21 am    Post subject: Reply with quote

xxx

Last edited by Robby on Sun Dec 11, 2011 1:28 am; edited 1 time in total
Back to top
View user's profile Send private message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Wed May 28, 2008 8:41 am    Post subject: Reply with quote

xxxx

Last edited by Robby on Sun Dec 11, 2011 1:28 am; edited 1 time in total
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2696
Location: Apeldoorn, Netherland

PostPosted: Wed May 28, 2008 1:17 pm    Post subject: Reply with quote

Hello Robby


Code:

ColumnValue=getXXX(Column)

getxxx should mean you take different things in your case maybe string, integer,float
so you get: getString

After that it looks me not compleet getstring is not a basic instruction as far as I know. I think it belong to a resultsetmethode so I think you get: rs.getstring(column).

Maybe I'm wrong. I gues.

Romke
Back to top
View user's profile Send private message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Thu May 29, 2008 4:12 am    Post subject: Reply with quote

xxxx

Last edited by Robby on Sun Dec 11, 2011 1:28 am; edited 1 time in total
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2696
Location: Apeldoorn, Netherland

PostPosted: Thu May 29, 2008 8:06 am    Post subject: Reply with quote

Hello Robby

I did again study your posts. I also did study your code in this program. I do use several times a search with OOo. Most of the times I make a text field in the way you use the combo box. That I dion't can navigate is not a problem if I put in some key the search wil start again. Most of the time three or four keys are enough.

Now to your code.
In this code I use a text field and not a combo field.
The textfield is not bound to a table.
I have a little change your code. I have move a little. The reason for moving is that you can check earlier for errors that looks me good.
An other change is the error in the program. Maybe it was not an error and something else.

If you have question I will try answer. This code is new for and maybe I can use it sometime.

I hope it helps you
Romke
Code:
Function findFirst(rs As Object,_
                ColumnName As String,_
                Target As Variant,_
                 Optional StartPos  As Integer) As Integer
   Dim ColIndex As Integer
   Dim Column As variant rem is field value
   If IsMissing(StartPos) Then
      StartPos=1
   End If
   ColIndex=rs.findColumn(ColumnName)
   
   If ColIndex<1 Or ColIndex > rs.Columns.Count Then
      Exit Function
   End If
   rs.absolute(StartPos)
   Do
      Column =rs.getstring(ColIndex) ' Haal waarde uit record
       If instr(1,Column,Target,1) Then
            findFirst=rs.Row rem value is found five it to function
            Exit Function
         End If
    Loop While rs.next()
   exit function

End Function






sub zoekzo (Event As Object)
Dim Form As Object
Dim Pos As Integer
Dim FormImpName As String
Dim rs as Object
rem test if it is the service
FormImpName="com.sun.star.comp.forms.ODatabaseForm"
Form= Event.Source.Model.Parent '
If Form.ImplementationName<>FormImpName Then
      Exit sub rem  wrong service
   End If
rem make an resultset
rs=Form.createResultSet()

'It is the good form start action
 pos=findFirst(Form,"name",Event.source.text)
 Form.absolute(pos) rem goto the position

   If pos>0 Then
      Form.absolute(pos)
   End If
end sub
Back to top
View user's profile Send private message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Thu May 29, 2008 9:16 am    Post subject: Reply with quote

xxx

Last edited by Robby on Sun Dec 11, 2011 1:27 am; edited 1 time in total
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2696
Location: Apeldoorn, Netherland

PostPosted: Thu May 29, 2008 10:31 am    Post subject: Reply with quote

Hello Robby

You can not test it in edit mode read my post
link: http://www.oooforum.org/forum/viewtopic.phtml?t=71601

May be this is a solution.

Romke
Back to top
View user's profile Send private message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Thu May 29, 2008 11:15 am    Post subject: Reply with quote

xxx

Last edited by Robby on Sun Dec 11, 2011 1:27 am; edited 1 time in total
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2696
Location: Apeldoorn, Netherland

PostPosted: Thu May 29, 2008 11:59 am    Post subject: Reply with quote

Hello Robby

I have it in the same basic module, but it is not necessary I think.

Can you print the value in the search routine Zoekzo. You can check on what place you do lose the value. I don't have a problem with the value.

I try to make it more flexible and in one subroutine. Learn maybe how you can make a hiddenfield. I will try to do something with that. I'm not sure about that.
It is good to read that you know that other one but you must exclude every thing.

Romke
Back to top
View user's profile Send private message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Thu May 29, 2008 12:44 pm    Post subject: Reply with quote

xxx

Last edited by Robby on Sun Dec 11, 2011 1:27 am; edited 1 time in total
Back to top
View user's profile Send private message
Voobase
OOo Advocate
OOo Advocate


Joined: 21 Nov 2007
Posts: 400
Location: Australia

PostPosted: Thu May 29, 2008 1:49 pm    Post subject: Reply with quote

Hi Robby,

The "Getxxx" is calling another function which can be found in the "Database Development" pdf. It is a function that is written by C.Benitez that determines which type of Get statement is required and uses it. If you do a search in the document you should find it. Cut and paste it into your code and then the "findfirst" function should work properly.

FindFirst will return the row number, so you should be able to then go to the row number with something lke oForm.absolute(FindFirst(oForm, column_name, target_name) Start pos is optional.

For example: oForm.Absolute(findFirst(oForm,"ColumnName",aString)) where aString is a variable that holds the search string.

Cheers

Voo
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2696
Location: Apeldoorn, Netherland

PostPosted: Thu May 29, 2008 2:02 pm    Post subject: Reply with quote

Hello Robby

This code will help you for looking to good form.
Code:
Form= Event.Source.Model.Parent
print form.rowcount,form.name,form.command


The first line is in the code the second line you need to place after the first line.

It gives you
1) the numbers of records
2) the name of the form
3) The base of the table: Can be a real table ,query or view

if the code "print form.rowcount,form.name,form.command" gives good values you can it try in the function with form=rs

Code:
option explicit

Type this as first line in your code direct after "REM **** BASIC***"
with that line you must dim every variable. If you make a typo you get the message Variable not defined. The program stop.
How much forms do you see in the form-navigator?

Romke
Back to top
View user's profile Send private message
Robby
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 249

PostPosted: Thu May 29, 2008 8:36 pm    Post subject: Reply with quote

xxx

Last edited by Robby on Sun Dec 11, 2011 1:27 am; edited 1 time in total
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
Goto page 1, 2, 3  Next
Page 1 of 3

 
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