Selecting a record with a combo box.

Creating and using forms

Selecting a record with a combo box.

Postby geleugim » Thu Nov 29, 2007 6:05 pm

Hello,

I am trying to use a combo box to display a record. I think I need to add a macro into the After updating field.
I can't find a macro for this. Is there one available for this?

In MS Access I can do this by using this bit of code.
Private Sub Combo2_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Song_Name] = '" & Me![Combo2] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Thanks for your help!
geleugim
 
Posts: 1
Joined: Thu Nov 29, 2007 5:49 pm

Re: Selecting a record with a combo box.

Postby RonIA » Sat Dec 01, 2007 6:16 am

Sorry I don't have the answer for you, I'm still trying to learn it myself. New job where I don't use DBs regularly really puts a crimp in learning new DBs.

Try
http://toolkit.its.isu.edu/Documentation/StarOffice/StarOffice_Basic_Guide_en-US.PDF
Ron from Iowa, USA
RonIA
Volunteer
 
Posts: 139
Joined: Mon Oct 08, 2007 1:34 am
Location: Iowa USA

Re: Selecting a record with a combo box.

Postby wurzel » Fri Jan 11, 2008 11:23 pm

geleugim wrote:Hello,

I am trying to use a combo box to display a record. I think I need to add a macro into the After updating field.
I can't find a macro for this. Is there one available for this?


Hi,

Errmm, how about reloading the form ? You can do this programmatically with form.reload()

Alex
wurzel
Volunteer
 
Posts: 145
Joined: Sun Dec 09, 2007 10:39 am

Re: Selecting a record with a combo box.

Postby kabing » Sat Jan 12, 2008 6:14 am

If you mean that you want to use a combo box to select or search for a particular record, you might find this thread from the OpenOffice.org Forum helpful.

Here's the macro I ended up using:

Code: Select all   Expand viewCollapse view
Sub SearchByStateOrProvince

dim oFilter as object
dim oFormCtl as object

oFormCtl = ThisComponent.Drawpage.Forms.getByName("Standard")
oFilter = oFormCtl.getByName("StateSearchListBox")

if oFilter.CurrentValue <> "" then
oFormCtl.Filter = "State LIKE " + "'"+oFilter.CurrentValue+"'"
oFormCtl.ApplyFilter = True
else
oFormCtl.ApplyFilter = False
end if

oFormCtl.Reload
End Sub


But reading the full thread there will give you more background.

There is also this tutorial written for NeoOffice. Since NeoOffice is based on OpenOffice.org, the instructions should work fine for OpenOffice.org, if you keep the following things in mind:

1) references to the command key in a Neo tutorial are the equivalent to the control key in OOo. (i.e. Command-C becomes Control-C) Note that I'm not sure if this is true with OOo for X11.
2) control-clicking is the same as right clicking
3) icons sometimes look different, as NeoOffice 2.2.2 has a custom icon set.

I should also note, though, that this article I linked to is part of a longer tutorial, and some people may find it difficult to drop into the middle of the series and make sense of the table and field names, etc.

kabing
NeoOffice (app store version) OpenOffice.org 4.1 and LibreOffice 4.3 on Mac OS X El Capitan
OpenOffice.org 4.1.2 on Windows 10 (Previously on Vista)
User avatar
kabing
Volunteer
 
Posts: 678
Joined: Fri Nov 23, 2007 12:05 am
Location: Midwest, USA


Return to Forms

Who is online

Users browsing this forum: No registered users and 2 guests