473,395 Members | 2,437 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,395 software developers and data experts.

custom button for next "non recurring record"

How would one create a button that on click advances the form to the
next "non recurring record" as opposed to the next record.

The field the button needs to que from has groups of duplicate values.
I need it to advance the form to the next group of duplicate values not
just the next record.

Jan 30 '06 #1
3 2190
Assuming the form is sorted by this field, you could FindFirst in the
RecordsetClone of the form.

This kind of thing:

Dim rs As DAO.Recordset
Dim strWhere As String
If Me.Dirty Then 'Save before move.
Me.Dirty = False
End If
If Not Me.NewRecord Then
strWhere = "[Field1] > " & Nz(Me.[Field1],0)
Set rs = Me.RecordsetClone
rs.FindFirst strWhere
If rs.NoMatch Then 'Go to a new record.
RunCommand acCmdRecordsGotoNew
Else 'Display the matched record.
Me.Bookmark = rs.Bookmark
End If
End If
Set rs = Nothing

Note: if Field1 is a Text field, you need extra quotes:
strWhere = "[Field1] > """ & [Field1] & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<do************@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
How would one create a button that on click advances the form to the
next "non recurring record" as opposed to the next record.

The field the button needs to que from has groups of duplicate values.
I need it to advance the form to the next group of duplicate values not
just the next record.

Jan 30 '06 #2
your code looks like this ...

Private Sub Next_Record_Click()
Dim rs As DAO.Recordset
Dim strWhere As String
If Me.Dirty Then 'Save before move.
Me.Dirty = False
End If
If Not Me.NewRecord Then
strWhere = "[MEDICAL RECORD NUMBER] > '''" & Nz(Me.[MEDICAL
RECORD NUMBER], 0)
Set rs = Me.RecordsetClone
rs.FindFirst strWhere
If rs.NoMatch Then 'Go to a new record.
RunCommand acCmdRecordsGoToNew
Else 'Display the matched record.
Me.Bookmark = rs.Bookmark
End If
End If
Set rs = Nothing
'Note: if Field1 is a Text field, you need extra quotes:
' strWhere = "[Field1] > """ & [Field1] & """"
End Sub

I could not get it to work however. I am also including this further
discription and would love to email my dbase to you for review if poss
let me know if I could send to you and where. I will try to email it to
the group but I doubt it will post.

I tried to only use numbers (no text) but it didn't work. I tried
adding extra """ because it "is" a text field but still
couldn't get it to work. I'm new at this and while I know I will
need to fix many many things in this database I feel that if I could
just get this part to work I can take the time to rebuild this database
and
Follow all the do's and don'ts (i.e. no spaces in the table names
and separate out / split the data into data and user forms and queries.

I have tryed to includ the database so you could have a better grasp of
what I'm trying to achieve here (the patient demographics data is not
the real data to protect the patients privacy).

In this example - When the Process Management form opens it would
start at medical record number RXJ00526434 with the associated
PHARMACEUTICAL NAME - FILGRASTIM. Ideally when the next button was
clicked the user would advance to the same medical record number
RXJ00526434 but with the associated PHARMACEUTICAL NAME - GRANISITRON
because that is the first instance where the PHARMACEUTICAL NAME
changed to another drug. The next click would take the user to the next
medical record number RXJ00510129 with the associated PHARMACEUTICAL
NAME - GEMCITABINE then GRANISITRON then FILGRASTIM then CARBOPLATIN.
The next click would advance to the next medical record number.

To simplify the button I seek that is to be on the Application Tracking
tab .....

If the identical medical record number has 16 instances of 4 like drugs
then it would take 4 clicks to advance to the next medical record
number.

Note The next tab on the form is there to show all 16 instances when
the need to see all instances is required.

Thanks,

Dom

Feb 1 '06 #3
If [MEDICAL RECORD NUMBER] is a Text field, you need:

strWhere = "[MEDICAL RECORD NUMBER] > """ & _
Me.[MEDICAL RECORD NUMBER] & """"

Please do not email the database. I hope you can understand that we cannot
examine everyone's database for free and still get any work done.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<do************@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
your code looks like this ...

Private Sub Next_Record_Click()
Dim rs As DAO.Recordset
Dim strWhere As String
If Me.Dirty Then 'Save before move.
Me.Dirty = False
End If
If Not Me.NewRecord Then
strWhere = "[MEDICAL RECORD NUMBER] > '''" & Nz(Me.[MEDICAL
RECORD NUMBER], 0)
Set rs = Me.RecordsetClone
rs.FindFirst strWhere
If rs.NoMatch Then 'Go to a new record.
RunCommand acCmdRecordsGoToNew
Else 'Display the matched record.
Me.Bookmark = rs.Bookmark
End If
End If
Set rs = Nothing
'Note: if Field1 is a Text field, you need extra quotes:
' strWhere = "[Field1] > """ & [Field1] & """"
End Sub

I could not get it to work however. I am also including this further
discription and would love to email my dbase to you for review if poss
let me know if I could send to you and where. I will try to email it to
the group but I doubt it will post.

I tried to only use numbers (no text) but it didn't work. I tried
adding extra """ because it "is" a text field but still
couldn't get it to work. I'm new at this and while I know I will
need to fix many many things in this database I feel that if I could
just get this part to work I can take the time to rebuild this database
and
Follow all the do's and don'ts (i.e. no spaces in the table names
and separate out / split the data into data and user forms and queries.

I have tryed to includ the database so you could have a better grasp of
what I'm trying to achieve here (the patient demographics data is not
the real data to protect the patients privacy).

In this example - When the Process Management form opens it would
start at medical record number RXJ00526434 with the associated
PHARMACEUTICAL NAME - FILGRASTIM. Ideally when the next button was
clicked the user would advance to the same medical record number
RXJ00526434 but with the associated PHARMACEUTICAL NAME - GRANISITRON
because that is the first instance where the PHARMACEUTICAL NAME
changed to another drug. The next click would take the user to the next
medical record number RXJ00510129 with the associated PHARMACEUTICAL
NAME - GEMCITABINE then GRANISITRON then FILGRASTIM then CARBOPLATIN.
The next click would advance to the next medical record number.

To simplify the button I seek that is to be on the Application Tracking
tab .....

If the identical medical record number has 16 instances of 4 like drugs
then it would take 4 clicks to advance to the next medical record
number.

Note The next tab on the form is there to show all 16 instances when
the need to see all instances is required.

Feb 2 '06 #4

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

Similar topics

0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
4
by: Tim | last post by:
I have used a graphic 'next record' button on a form. How can I stop it from going past the last existing record? In other words, I don't want it to take the user to a blank record. Thanks Tim
1
by: me | last post by:
I'm building a multi user app where many admins will be making calls to people in one table. I want to keep things simple and find a way to prevent 2 or more admins from working on the same record...
3
by: vanvee | last post by:
Hi I am trying to program a VB.Net Windows application (in a client server environment with multiple users) and am seeking some help about a possible technique to handle concurreny issues. I am...
1
by: AA Arens | last post by:
I my form I have put record navigation buttons. When I choose just before the last record, the "Go to next record" button, access automatically start with a new record instead of a message that...
10
by: giannis | last post by:
How can i know ("see") the next record using the BindingSource without move to the next record ?
1
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I have Mobile site that I'm building. My problem is that all of my pages are built as Mobile ASPX pages, but occasionally, I need to use controls which are not mobile. Most specifically, the...
6
by: Chezza | last post by:
Hi All, Similar to many other posters, I don’t have a lot of experience with access (I'm using access 2003) and know little of VB, although I have picked up a bit while working on this project. ...
2
by: MLH | last post by:
I have an A97 form with Allow Edits, Allow Deletions and Allow Additions properties set. Scrolling through records will eventually take me to the end of the records and one more PgDn will take me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.