473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Performing actions based on a specific record

I have two problems I am trying to solve.

1) I am needing to be able to double-click on a list and have it open
another form with the details. I will need the detailed form to be a
stand alone form, so I don't think I can use a sub-form. I've looked
through the group listings and can't seem to find a solution that
doesn't use a sub-form solution. Was thinking the SelTop or
CurrentRecord commands would do what I want, but can't find any code
examples that use it. Thinking I could attach some VB code to the
double-click and use the where function of a query to filter the
results in the detailed form. Hoping someone who's done this could
help!

2) I figure this one is easier and that I'm just not calling it the
proper name when I'm searching newsgroups, so I apologize if it's
already been asked. I have a form that allows users to look at each
record, one at a time by clicking the "play/fast-forward, rewind, etc"
buttons (forgot the formal name for it -- sorry). This can be
cumbersome if there are 1000s of records though, so I'm trying to give
the end-user another way to get to the record they need. I've added a
list box that shows all of the unique ID numbers. I'd like, as the
user goes forward/backward a record at a time, for the ID number in the
list box to be highlighted. Conversely, I'd also like for the user to
be able to highlight a record in the list box and have the form go to
that particular record.

I'm new to programming with Access and don't necessarily have the lingo
down, so I'm probably just not searching on appropriate key words. Any
help (with examples) would be greatly appreciated.

Thanks,
Lisa

Mar 20 '06 #1
3 1402
More information:
On the second problem, when I make the controlsource equal to the
"ID Number", it seems to half work (i.e. when I click through the
entries, the list box shows the appropriate id number). However when I
click on a different record in the list, my form thinks that I am
changing the value of the current record. As a result, I get the
following error: "The changes you requested to the table were not
successful because they would create duplicate values in the index,
primary key, or relationship....", which makes sense. Is there a way
circumvent the form thinking that I'm wanting to change the current
record?... maybe using the "before update" function?

Again.. thanks for the help.

Lisa

Mar 20 '06 #2
Ok, I've been playing a little more with my problem #1 listed at the
beginning of this thread. In trying to identify the record
highlighted, I wrote the following code:

Private Sub CapMatList_Click()
Dim strDesiredFunctQuery As String
Dim ctl As Control
Dim varItm As Variant, intI As Integer

Set ctl = Me.CapMatList

For Each varItm In Me.CapMatList.ItemsSelected
For intI = 0 To ctl.ColumnCount - 1
If (intI = 0) Then
strDesiredFunctQuery = "Select [Request
Breakdown].[Details] from [Request Breakdown], [Capability Import]
where [Request Breakdown].[Capability]=""" & ctl.Column(intI, varItm) &
""""
Me!DesiredList.RowSource = strDesiredFunctQuery
Me.DesiredList.Requery
Debug.Print strDesiredFunctQuery
End If
Next intI
Next varItm
End Sub

This works when I have the multiselect set to Simple. However, when I
set it to None (which is what is desired), it will not go through the
loop. Any ideas?

Lisa

Mar 20 '06 #3

"Lisa Burks" <li*******@gmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Ok, I've been playing a little more with my problem #1 listed at the
beginning of this thread. In trying to identify the record
highlighted, I wrote the following code:

Private Sub CapMatList_Click()
Dim strDesiredFunctQuery As String
Dim ctl As Control
Dim varItm As Variant, intI As Integer

Set ctl = Me.CapMatList

For Each varItm In Me.CapMatList.ItemsSelected
For intI = 0 To ctl.ColumnCount - 1
If (intI = 0) Then
strDesiredFunctQuery = "Select [Request
Breakdown].[Details] from [Request Breakdown], [Capability Import]
where [Request Breakdown].[Capability]=""" & ctl.Column(intI, varItm) &
""""
Me!DesiredList.RowSource = strDesiredFunctQuery
Me.DesiredList.Requery
Debug.Print strDesiredFunctQuery
End If
Next intI
Next varItm
End Sub

This works when I have the multiselect set to Simple. However, when I
set it to None (which is what is desired), it will not go through the
loop. Any ideas?

Lisa



Hi Lisa
You are making it all to hard for yourself. If the listbox has no
multiselct then you can simply write:
Me.MyListBox.Value
Normally for a list box the first column is set to the unique record id and
the bound column is set to 1. The first column can be made invisible
(column width=0) if the id is an arbitrary value not to be seen by the user.

As for your second point with the "play/fast-forward, rewind, etc" buttons,
thes are called Navigation Buttons and their function is not really to find
records. It looks as though you are not using the most basic of Access
functionality of putting your cursor in the field you want to search by and
pressing CTRL-F.

Mar 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Roderik | last post by:
Is it possible to perform actions at certain moments. Like resetting a database record every first day of month? regards, Roderik
3
by: Clifford Schneider | last post by:
Hello, I have several SQL Server jobs that execute procedures written to run deletes and updates against tables in my data warehouse. Some jobs occasionally get stuck with the status "Performing...
1
by: ammarton | last post by:
Hello all...I'm a bit new to working with Macros in Access so forgive me if the terminology I use is not accurate. To preface this, basically I am using a form on a replicated database so the...
1
by: Will | last post by:
In Access 97 under options/edit find/Confirm - Record Changes, Document Deletions, Action Queries. Can someone tell me if these options are specific per each MDB file or are set by each PC's copy...
6
by: Chris Fink | last post by:
I have the need to perform an atomic operation in two systems, a database and an ftp site. The process is two step; 1. insert a row into oracle, 2. delete a file from a remote ftp site. I need to...
1
by: Martin Bentler | last post by:
Right now, I have a form, locked records, on which I have a CommandButton that opens a second form (much like the first) but open for editing, plus allowing the user to manipulate other areas of the...
16
by: zoeb | last post by:
Hi, I am a complete novice to Access VBA and looking for some help to select a record. I am looking to perform an operation on the previous record - i.e. adding a new blank field, and then...
36
by: CK | last post by:
How do I write a set based query? I have a groupSets table with fields setId, idField, datasource, nameField, prefix, active Data: 1,someIDfield, someTable, someField, pre1, 1 2,someotherIDfield,...
2
by: Stratocaster | last post by:
Hello, and thank you for any help in advance. I need help determining if any commands exist in VB (Excel macro style) that can enable a user to select cells and run a macro which performs...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.