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

Combo-Box & FindFirst Problem !

I have a form (continuous) with a few fields :
First Name, Last Name, Policy Number, etc.

In the form footer I have a combo box for LastName which has 3 TEXT
fields: LastName, FirstName & Policy Number

When the user clicks a LastName on the Combo it should seek & position
me on that record on the continuous form. That's ok till here.

The problem is: It always position me on the 1st ocurence of the
LastName. Here's an example ...

L.Name F.Name Policy-Num
Astle Abbey 45
Bodey Art 56
Coelho Benny 87
Coelho Sebastian 33
Coelho Sebastian 34
Coelho Sebastian 35
Coelho Sebastian 36
Coelho Sebastian 37

Now, if I click on the 7th row Policy Number 36 (Coelho Sebastian), I
get positioned at Policy Number 87 (Coelho Benny).
Here's the SQL code for my combo box row source:
SELECT PMF.I_NAME_L, PMF.I_NAME_F, PMF.POLNO FROM PMF ORDER BY
PMF.I_NAME_L, PMF.I_NAME_F, PMF.POLNO;
Here's my combo-box Find Routine Code:

Private Sub Cmb_LName_Click()
Me.OrderBy = "I_NAME_L, I_NAME_F"
Me.OrderByOn = True ' Putting it for safety JUST TO BE SURE

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[I_NAME_L] = '" & Me.Cmb_LName.Column(0) & "' and "
& _
"[I_NAME_F]= '" & Me.Cmb_LName.Column(1) & "' and "
& _
"[POLNO]= '" & Me.Cmb_LName.Column(2) & "'"
Me.Bookmark = rs.Bookmark

Me.I_NAME_L.BackColor = 16777088
End Sub
Can someone please point out what I'm doing wrong ? I'm sure it's
something very minor that I'm overlooking.

Thx & Best Rgds,
Prakash.
Nov 12 '05 #1
2 4097
Prakash,

I have had a similar issue also. See
http://www.google.nl/gr*************...e.nl&lr=&hl=nl
Apparantly the issue is fixed in A2k Sp3. At least I can't reproduce it anymore (just installed sp3)
In A97 I still can reproduce it (SR2)

It's 'something' with the scope of the column(x) property I think.

I am pretty sure the following works if you add this in your sub:
Dim txtColum0 as text
Dim txtColum1 as text
Dim txtColum2 as text
txtColumn0=Me.Cmb_LName.Column(0)
txtColumn1=Me.Cmb_LName.Column(1)
txtColumn2=Me.Cmb_LName.Column(2)

Now if you will use there vars instead of the Column(x) property's then I think your code will work.

--
Hope this helps
Arno R



Nov 12 '05 #2
Hi Arno ... Thx !! I solved it a couple of hrs back but was waiting
for my post to show up on the NG. As you suggested, I did store the
value to variables & shifted some statements back & forth & got it to
work. BTW, I'm using AXP over WinXP. (I don't think it's a bug with
Access ... it seems to be a slight logic problem with my code).
Because I change the ORDER of the records, the bookmark also changes.
Here's the code ...
===== Code Snippet Starts Here ==================================

Private Sub Cmb_LName_Click()
' DO NOT CHANGE THE ORDER of the statements in this routine.
' i.e. the variable names need to be stored 1st; then the ORDER BY
& then the FINDFIRST
'MsgBox (Me.Cmb_LName.Column(0))
'MsgBox (Me.Cmb_LName.Column(1))
'MsgBox (Me.Cmb_LName.Column(2))

Dim FName, LName, Pol_No As String
LName = Me.Cmb_LName.Column(0)
FName = Me.Cmb_LName.Column(1)
Pol_No = Me.Cmb_LName.Column(2)

Me.OrderBy = "I_NAME_L, I_NAME_F, POLNO"
Me.OrderByOn = True ' Putting it for safety JUST TO BE SURE

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[I_NAME_L] = '" & LName & "' and " & _
"[I_NAME_F]= '" & FName & "' and " & _
"[POLNO]= '" & Pol_No & "'"
Me.Bookmark = rs.Bookmark

Me.I_NAME_L.BackColor = 16777088
Me.I_NAME_F.BackColor = -2147483643 'White
End Sub

===== End of Code Snippet =================================

Thx for your help & time ...
Best Rgds,
Prakash.


"Arno R" <ar****************@tiscali.nl> wrote in message news:<3f**********************@dreader2.news.tisca li.nl>...
Prakash,

I have had a similar issue also. See
http://www.google.nl/gr*************...e.nl&lr=&hl=nl
Apparantly the issue is fixed in A2k Sp3. At least I can't reproduce it anymore (just installed sp3)
In A97 I still can reproduce it (SR2)

It's 'something' with the scope of the column(x) property I think.

I am pretty sure the following works if you add this in your sub:
Dim txtColum0 as text
Dim txtColum1 as text
Dim txtColum2 as text
txtColumn0=Me.Cmb_LName.Column(0)
txtColumn1=Me.Cmb_LName.Column(1)
txtColumn2=Me.Cmb_LName.Column(2)

Now if you will use there vars instead of the Column(x) property's then I think your code will work.

Nov 12 '05 #3

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

Similar topics

5
by: Harry Haller | last post by:
<select name="cboPlaces" id="cboPlaces"> <option value="3">Countryside</option> <option value="4">Forest</option> <option value="5">Mountain</option> <option value="6">Desert</option> <option...
1
by: Tina McGibben | last post by:
I basically have a form with a subform with two combo boxes on the main form which filter the subform. The code below works except I cant seem to get it to show all the worksheets when there is...
8
by: bbdata | last post by:
ok i have a problem here and not much time to play round. have a form bound to a table. one of the combos is bound to a field Agents. i have active and retired agents. thing is, i want to be able...
2
by: Al | last post by:
hi,I am using asp.net(vb) I am trying to create 3 combo boxes which are dependable on each other. when comb1 is selected, it shows the comb2 data based on the selection in combo1 and when combo2...
1
by: Alejandro González | last post by:
Hi I have a combobox binded to a Datatable something like combo.DataSource = dt.DefaultView; combo.DisplayMember = "descField"; combo.ValueMember = "valueField"; it works fine.
2
by: G .Net | last post by:
Hi Is there a way to prevent the combo displaying its list of items when the "combo arrow" is clicked? The problem I'm trying to resolve is that depending on a Boolean value, which is set...
8
by: AA Arens | last post by:
Hi I do have a products table and products-parts table in my Access 2003 database and log all services into a form. I do have at least the following two combo boxes on my form: - Choose...
3
by: John | last post by:
AC2007 I changed my combo's row source and then the autocomplete stopped working. The combo is two columns, bound to the first. First column is primary key (ID). Second column is a...
2
by: Ruthenfods Tellez | last post by:
I have an application in asp; in my form I have a combo and a textbox, the combo is fill in from a database query. I cannot do the following: when selecting an item from the combo, it should send...
4
by: User | last post by:
Hi people, Excuse if my question is silly, but... i have 2 combo boxes in my project they are binded to fields from same table... one is binded do Code field and another to Description field...
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: 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
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
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.