A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Please Help !



 
 
Thread Tools Display Modes
  #1  
Old December 19th, 2006, 02:59 AM posted to microsoft.public.access.forms
Sonja
external usenet poster
 
Posts: 38
Default Please Help !

Hi,

I'm designing a "site information" database and I'm hoping you can help me
with the following questions/issues I've come up against, please ?

1. I've created a form based on a table to display site information on a
one-at-a-time basis. I want to be able to search and display the information
by 3 unique fields, ie: name, number and ID. So, the idea is: you open the
form, you know which of our 300 sites you want to see the info for and you
have the choice of displaying that info by choosing a value from one of 3
combo boxes (ie: you may only know the ID, not the name or number, so you go
to the ID field and you hit the arrow to display the list, then you choose
which one you're after and the other fields in the form update to display
that ID's information).

I've currently got the form working with 1 combo box, which updates the rest
of the form after choosing a value from the list, but I'm stuck when trying
to create the other 2 for search and display as well.

Any ideas would be much appreciated !

  #2  
Old December 19th, 2006, 06:15 AM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 264
Default Please Help !

do your combobox wizards work? There's a wizard that does this...

  #3  
Old December 19th, 2006, 03:01 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Please Help !

Actually, you only need one combo box to do your searching. The combo should
not be a bound control. Here are two subs that are the code necessary to use
one combo for 3 different search options. You also need an option group with
3 buttons, one for each search filed.

First, set the combo's properties to suit the first (Default) choice. Set
the Default Value of the option group to 1. Now, adjust the code to suit
your fields, names, column widths, etc.

Note: all the properties that require sizing (ColumnWidths, etc) are in
twips. There are 1440 twips per inch.

Now the user just selects how she wants to do the search and the selected
record will be displayed:

'Code for the After Update event of the Combo Box:

Private Sub cboSearch_AfterUpdate()
Dim strFind As String

Select Case Me.opgSearch
Case 1
strFind = "[Activity] = """ & Me.cboSearch & """"
Case 2
strFind = "[itm] = """ & Me.cboSearch & """"
Case 3
strFind = "[MActivity] = """ & Me.cboSearch & """"
End Select

With Me.RecordsetClone
.FindFirst strFind
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub

'Code for the Option Group After Upate:

Private Sub opgSearch_AfterUpdate()

Select Case Me.opgSearch
Case 1
With Me.cboSearch
.RowSource = "SELECT DISTINCT Activity, Description FROM " & _
"CisAttributeTable_ME;"
.ColumnCount = 2
.ColumnWidths = "1584; 5184"
.ListWidth = 6768
.Width = 3312
.Value = Null
End With
Me.lblSearch.Caption = "Activity"
Case 2
With Me.cboSearch
.RowSource = "SELECT DISTINCT ITM FROM CisAttributeTable_ME
" & _
"WHERE ITM IS NOT NULL;"
.ColumnCount = 1
.ColumnWidths = 1584
.ListWidth = 1584
.Width = 1600
.Value = Null
End With
Me.lblSearch.Caption = "ITM"
Case 3
With Me.cboSearch
.RowSource = "SELECT DISTINCT MActivity FROM
CisAttributeTable_ME " & _
"WHERE MActivity IS NOT NULL;"
.ColumnCount = 1
.ColumnWidths = 1584
.ListWidth = 1584
.Width = 2000
.Value = Null
End With
Me.lblSearch.Caption = "Master"
End Select

End Sub


"Sonja" wrote:

Hi,

I'm designing a "site information" database and I'm hoping you can help me
with the following questions/issues I've come up against, please ?

1. I've created a form based on a table to display site information on a
one-at-a-time basis. I want to be able to search and display the information
by 3 unique fields, ie: name, number and ID. So, the idea is: you open the
form, you know which of our 300 sites you want to see the info for and you
have the choice of displaying that info by choosing a value from one of 3
combo boxes (ie: you may only know the ID, not the name or number, so you go
to the ID field and you hit the arrow to display the list, then you choose
which one you're after and the other fields in the form update to display
that ID's information).

I've currently got the form working with 1 combo box, which updates the rest
of the form after choosing a value from the list, but I'm stuck when trying
to create the other 2 for search and display as well.

Any ideas would be much appreciated !

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.