PC Review


Reply
Thread Tools Rate Thread

Combo Box Choose Record Problem

 
 
Hannah B
Guest
Posts: n/a
 
      9th Jun 2010
Hi All,

Had a wee dig around on this forum but can't find how to fix this
problem - apologies if I've just missed the explanation! Apologies for
un-technical language/poor description - I'm a complete novice at all
this!

I've got a form with 4 cascading combo boxes on it and each narrows
down the user's choices until they've picked a record. That bit works
successfully. Where I've got the problem is when people use the scroll
wheel on the mouse, I want my combo boxes to reflect the new record
they've scrolled to. I've managed this to an extent (works perfect for
the first three combo boxes) but I can't seem to get the final combo
box (cmbPlot) to reflect the record it's on. Worse still, cmbPlot
remains consistently blank - even when you select a value in it, it
immediately goes blank straight after.

I think this must be something to do with the fact that the cmbPlot is
a 2 column combo box where the others are all single column combo
boxes. cmbPlot is the combo box where I have code to choose the record
(hence the 2 columns which are called SurveyID and Surveyed for info).
I know there's something wrong in my code but I just don't know what
it is! Does anybody know how I can overcome this problem? I've pasted
in the code I've used below and please just let me know if you need
anymore info - my explanations aren't always the best! Thanks so much
for all your help already, this is really bugging me!

Hannah

Private Sub Form_Current()
Me!cmbBeach = RefNo
Me!cmbYear = Year
Me!cmbPeriod = Period
Me!cmbPlot = SurveyID

'cmbBeach.Requery
'cmbYear.Requery
'cmbPeriod.Requery
'cmbPlot.Requery


End Sub
Private Sub cmbBeach_AfterUpdate()


Me.[cmbYear] = Null
Me.[cmbYear].Requery

Me.[cmbPeriod] = Null
Me.[cmbPeriod].Requery

Me.[cmbPlot] = Null
Me.[cmbPlot].Requery

End Sub

Private Sub cmbYear_AfterUpdate()

Me.[cmbPeriod] = Null
Me.[cmbPeriod].Requery

Me.[cmbPlot] = Null
Me.[cmbPlot].Requery

End Sub

Private Sub cmbPeriod_AfterUpdate()

Me.[cmbPlot] = Null
Me.[cmbPlot].Requery

End Sub

Private Sub cmbPlot_AfterUpdate()

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[SurveyID] = " & Str(Me![cmbPlot])
Me.Bookmark = rs.Bookmark

End Sub
 
Reply With Quote
 
 
 
 
Hannah B
Guest
Posts: n/a
 
      10th Jun 2010
Thanks for such a speedy reply. Changing the column width away from 0
means that the combo box now follows the record (yay!) but also means
that I now display the column I want to keep hidden instead (SurveyID
is there to find the record; Surveyed is the name of the field I want
displayed). Do you know how it would be possible to still hide
SurveyID but display Surveyed in cmbPlot so that it matches the
record? I'm pretty certain there's a flaw (probably multiple flaws) in
my code and/or general form design somewhere but I can't work out what
it is! Thanks again for all your help, I really really appreciate it!

Hannah


On Jun 9, 4:35*pm, "Arvin Meyer" <arv...@invalid.org> wrote:
> Have you checked the ColumnCount and ColumnWidth properties? The symptoms
> you describe sound like either the column count is incorrrect, ot the width
> of the column that you are trying yo display is set to 0.
> --
> Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.accessmvp.comhttp://www.mvps.org/access
> Co-author: "Access 2010 Solutions", published by Wiley
>

 
Reply With Quote
 
Hannah B
Guest
Posts: n/a
 
      11th Jun 2010
Thank you for bearing with me on this one - I'm really not sure what
the answer is. I tried switching the SurveyID column width back to
zero but that just took me back to the start of the problem.

With a bit of playing around, cmbPlot only seems to pick up the
SurveyID for the first record chosen using the combo boxes and will
display that. When you scroll to different records, however, it
doesn't seem to pick up the SurveyID at all. If you click on the combo
box, it only shows the options for the first record you chose, not
what's shown currently on the rest of the form.

I think therefore that there has to be some kind of problem with this
section of my code:

Private Sub Form_Current()
Me!cmbBeach = RefNo
Me!cmbYear = Year
Me!cmbPeriod = Period
Me!cmbPlot = SurveyID


'cmbBeach.Requery
'cmbYear.Requery
'cmbPeriod.Requery
'cmbPlot.Requery


End Sub

I'm pretty certain that there's something wrong with the bits that
refer to cmbPlot but I don't know what they are. I want cmbPlot to
reflect the SurveyID shown in a text box control on the form but
display the Surveyed field based on that record. At the moment that
doesn't seem to work and I'm not sure what to try next. Thanks again
for all your help - I'm not sure what us complete beginners would do
without forums like this!

Hannah
 
Reply With Quote
 
Hannah B
Guest
Posts: n/a
 
      11th Jun 2010
They're unbound combo boxes (so that they can cascade from one
another) and I'm afraid your code didn't work. Thanks ever so much
again for all your help, I really appreciate it.

Hannah
 
Reply With Quote
 
Hannah B
Guest
Posts: n/a
 
      14th Jun 2010
Just wanted to say thank you very much for all your help - I really
really appreciate it. I'd thought about just disabling the mouse wheel
but hoped there was another way but disabling the mouse might just be
the way to go. Thanks again for all your suggestions, they've really
helped me out.

Hannah
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form - problem trying to find record with combo box sherry.walker Microsoft Access Forms 3 24th Feb 2008 12:42 PM
Cannot choose a record from a combo box Jack Microsoft Access VBA Modules 1 30th Jan 2008 02:25 AM
Populate combo box with record data when record is pulled by another combo box Minikoop Microsoft Access Forms 3 22nd Jul 2006 12:11 AM
Combo 'NotInList' > add record > refresh combo problem Fjordur Microsoft Access Forms 3 27th Jan 2006 09:09 PM
Goto Record Combo Box Problem =?Utf-8?B?VGltIEo=?= Microsoft Access Form Coding 3 29th Sep 2005 12:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:43 PM.