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  

Forms and combo boxs etc...



 
 
Thread Tools Display Modes
  #1  
Old December 14th, 2006, 02:56 PM posted to microsoft.public.access.forms
bilbo+
external usenet poster
 
Posts: 31
Default Forms and combo boxs etc...


Hi there, i have a form which i have tried to put a subform into which
contains a list of all the records in the database, so that one can quickly
scroll to one of them double click then get the original form to goto the new
form. This has been working up until recently where for some reason it now
doesnt work.Is there a better way to be doing this? or should i do it liek
this? i was thinking maybe a popup box where you select the job and it uses
the jobno on that form to set the jobno on the other form maybe... im not too
sure! any help much appreciated..
WK


Someone suggested using a combo box but i dont how to get it to work, the
combo box comes up with al lthe jobs but when i click on one it doesnt work..
i think this 9s because i associated the job no on the box to the job no on
the form which is an autonumber..??? what am i doing wrong how do i get it to
work!!! help!!

  #2  
Old December 14th, 2006, 04:58 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Forms and combo boxs etc...

Combo boxes don't do any record positioning on their own. To use a combo box
to locate and present a specific record takes a little coding, but is not
difficult and is the normal way to do this.

You will need to use a field in your record that is unique. This is often
the primary key field of the record. In many cases, this field may not
contain a value that is meaningful to a user. For example, we are trying to
look up a specific customer in the table and the primary key of the table is
an Autonumber. The user will not know that 4503 is John Smith. You will
have to use the customer name, but their might be more than one John Smith,
so we still need the CustomerID field to indentify a specific record.

The way to handle this is using a multi column combo. Ideally, we want the
user to see John Smith displayed, but we want to hide the key value of 4503.
So, here is the setup:

The combo should be an unbound control.

We create an SQL statement (or a stored query will work) that includes the
two columns:
SELECT CustLastName & ", " & CustFirstName, CustID As Customer ORDER BY
CustLastName, CustFirstName;

Set the following properties for the comb:
Column Count: 2
Bound Column: 1
Column Widths: 2.5";0" (change the 2.5" to the width you need. the
0 makes the CustID field hidden)

Now, to make it present the selected record, you need some code in the
combo's After Update event:

Private Sub cboCustomerSearch_AfterUpdate()
Dim rst As Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[CustID] = " & Me.cboCustomerSearch.Column(1)
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub


"bilbo+" wrote:


Hi there, i have a form which i have tried to put a subform into which
contains a list of all the records in the database, so that one can quickly
scroll to one of them double click then get the original form to goto the new
form. This has been working up until recently where for some reason it now
doesnt work.Is there a better way to be doing this? or should i do it liek
this? i was thinking maybe a popup box where you select the job and it uses
the jobno on that form to set the jobno on the other form maybe... im not too
sure! any help much appreciated..
WK


Someone suggested using a combo box but i dont how to get it to work, the
combo box comes up with al lthe jobs but when i click on one it doesnt work..
i think this 9s because i associated the job no on the box to the job no on
the form which is an autonumber..??? what am i doing wrong how do i get it to
work!!! help!!

 




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 10:19 AM.


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