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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Automatically retreiving information



 
 
Thread Tools Display Modes
  #1  
Old March 6th, 2006, 07:17 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Automatically retreiving information

Hi,

I'm making client profiles. Each profile is based on a abbreviation of the
name and location (5 letters). The details of the company like its code, name
and location is being retrieved from a different form to what I'm currently
using. What I need to do is that when I type in the code to enter a record,
it automatically produces the company name and location rather than the user
choosing down the drop down box or when I enter the company name and
location, the abbreviation code automatically comes up. Any help would be
great.

Thanks,
Saima
  #2  
Old March 6th, 2006, 03:30 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Automatically retreiving information

If set up correctly, the user doesn't have to "choose down a drop down". The
best way to do this is to use a combo box with Auto Expand set to Yes. This
way, the user can type in the value just like they would in a text box. It
also gives them visual feedback on whether they are typing in the value
correctly. It is also a lot less coding on your part. Here is some example
code I threw together (Pardon the lack of naming convention) that will allow
the user to select which field they want to search on by using a command
button. In this example, if the current search is by Activity, clicking the
button switches to search on description and visa versa. The combo is not
bound to a field, so it doesn't matter which way they search, when the record
is found, all the controls are loaded.

Private Sub Combo0_AfterUpdate()
Dim rst As DAO.Recordset
Dim strCriteria As String

If Me.Combo0.BoundColumn = 1 Then
strCriteria = "[Activity] = '"
Else
strCriteria = "[DESCRIPTION] = '"
End If
strCriteria = strCriteria & Me.Combo0.Column(0) & "'"
Set rst = Me.RecordsetClone
rst.FindFirst strCriteria
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub

Private Sub Command6_Click()
Dim strAct As String
Dim strDesc As String

strAct = "SELECT CISAttributeTable.ACTIVITY,
CISAttributeTable.DESCRIPTION FROM CISAttributeTable;"
strDesc = "SELECT CISAttributeTable.DESCRIPTION,
CISAttributeTable.ACTIVITY FROM CISAttributeTable;"
If Me.Combo0.BoundColumn = 1 Then
Me.Combo0.BoundColumn = 2
Me.Combo0.RowSource = strDesc
Me.Combo0.ColumnWidths = "2.5"";1.1"""
Else
Me.Combo0.BoundColumn = 1
Me.Combo0.RowSource = strAct
Me.Combo0.ColumnWidths = "1.1"";2.5"""
End If
End Sub


"Saima" wrote:

Hi,

I'm making client profiles. Each profile is based on a abbreviation of the
name and location (5 letters). The details of the company like its code, name
and location is being retrieved from a different form to what I'm currently
using. What I need to do is that when I type in the code to enter a record,
it automatically produces the company name and location rather than the user
choosing down the drop down box or when I enter the company name and
location, the abbreviation code automatically comes up. Any help would be
great.

Thanks,
Saima

  #3  
Old March 9th, 2006, 05:04 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Automatically retreiving information

Thank you for your help, it worked out.

Saima

"Klatuu" wrote:

If set up correctly, the user doesn't have to "choose down a drop down". The
best way to do this is to use a combo box with Auto Expand set to Yes. This
way, the user can type in the value just like they would in a text box. It
also gives them visual feedback on whether they are typing in the value
correctly. It is also a lot less coding on your part. Here is some example
code I threw together (Pardon the lack of naming convention) that will allow
the user to select which field they want to search on by using a command
button. In this example, if the current search is by Activity, clicking the
button switches to search on description and visa versa. The combo is not
bound to a field, so it doesn't matter which way they search, when the record
is found, all the controls are loaded.

Private Sub Combo0_AfterUpdate()
Dim rst As DAO.Recordset
Dim strCriteria As String

If Me.Combo0.BoundColumn = 1 Then
strCriteria = "[Activity] = '"
Else
strCriteria = "[DESCRIPTION] = '"
End If
strCriteria = strCriteria & Me.Combo0.Column(0) & "'"
Set rst = Me.RecordsetClone
rst.FindFirst strCriteria
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub

Private Sub Command6_Click()
Dim strAct As String
Dim strDesc As String

strAct = "SELECT CISAttributeTable.ACTIVITY,
CISAttributeTable.DESCRIPTION FROM CISAttributeTable;"
strDesc = "SELECT CISAttributeTable.DESCRIPTION,
CISAttributeTable.ACTIVITY FROM CISAttributeTable;"
If Me.Combo0.BoundColumn = 1 Then
Me.Combo0.BoundColumn = 2
Me.Combo0.RowSource = strDesc
Me.Combo0.ColumnWidths = "2.5"";1.1"""
Else
Me.Combo0.BoundColumn = 1
Me.Combo0.RowSource = strAct
Me.Combo0.ColumnWidths = "1.1"";2.5"""
End If
End Sub


"Saima" wrote:

Hi,

I'm making client profiles. Each profile is based on a abbreviation of the
name and location (5 letters). The details of the company like its code, name
and location is being retrieved from a different form to what I'm currently
using. What I need to do is that when I type in the code to enter a record,
it automatically produces the company name and location rather than the user
choosing down the drop down box or when I enter the company name and
location, the abbreviation code automatically comes up. Any help would be
great.

Thanks,
Saima

 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Consecuitive Employment time employed Dave E Running & Setting Up Queries 9 February 7th, 2006 05:06 PM
how do you have information from one tab automatically populate i excel newbe Worksheet Functions 2 January 19th, 2006 10:55 PM
Copy one field from one table to another bhp Using Forms 6 January 10th, 2006 04:12 PM
Automatically adding last modification date to footer Scott Meyers Powerpoint 1 January 7th, 2006 05:44 PM
Auto Filling Information Christina T Using Forms 3 June 3rd, 2005 03:32 PM


All times are GMT +1. The time now is 12:45 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.