473,659 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo Box Problem

I have a table (tblPhone) with text fields FULL, LAST, PHONE,

I also have a combo box (cmboFull) .
The row source for cmboFull is SELECT DISTINCT [FULL] FROM tblPhone;

Here's the code for the combo box

Private Sub cmboFull_AfterU pdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Cl one
rs.FindFirst "[Full] = '" & Me![cmboFull] & "'"
Me.Bookmark = rs.Bookmark
This combo box populates ok but when I click on any item in the combo box I
get the following error on the "Set rs = Me.Recordset.Cl one" statement.
Run time error '91'
Object variable or Withblock variable not set.

I used similar code in another program and it worked fine so I am puzzled
why it fails here.

Any ideas

The overall objective is to present a combo box containing the data in the
FULL field and
then set a couple of text boxes with the LAST and FULL fields in the
selected record.
Jun 5 '06 #1
3 2849
Try without the 2nd dot, i.e.:
Set rs = Me.RecordsetClo ne

There are several other things that could go wrong with that code, including
reference priorities, the need to test NoMatch, and weird messages if the
record cannot be saved to activate the move (e.g. "Cannot Update without
Edit first".) For an example of a FindFirst that takes care of these issues,
see:
http://allenbrowne.com/ser-03.html

--
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.

"RICHARD BROMBERG" <no*****@att.ne t> wrote in message
news:YT******** ************@bg tnsc05-news.ops.worldn et.att.net...
I have a table (tblPhone) with text fields FULL, LAST, PHONE,

I also have a combo box (cmboFull) .
The row source for cmboFull is SELECT DISTINCT [FULL] FROM tblPhone;

Here's the code for the combo box

Private Sub cmboFull_AfterU pdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Cl one
rs.FindFirst "[Full] = '" & Me![cmboFull] & "'"
Me.Bookmark = rs.Bookmark
This combo box populates ok but when I click on any item in the combo box
I
get the following error on the "Set rs = Me.Recordset.Cl one" statement.
Run time error '91'
Object variable or Withblock variable not set.

I used similar code in another program and it worked fine so I am puzzled
why it fails here.

Any ideas

The overall objective is to present a combo box containing the data in the
FULL field and
then set a couple of text boxes with the LAST and FULL fields in the
selected record.

Jun 5 '06 #2
Allen

I changed the code, removing the 2nd dot as you suggested, but that
generated the following error:
"You entered an expression that has an invalid reference to the
RecordsetClone property"

What else could be causing it.
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message
news:44******** *************** @per-qv1-newsreader-01.iinet.net.au ...
Try without the 2nd dot, i.e.:
Set rs = Me.RecordsetClo ne

There are several other things that could go wrong with that code, including reference priorities, the need to test NoMatch, and weird messages if the
record cannot be saved to activate the move (e.g. "Cannot Update without
Edit first".) For an example of a FindFirst that takes care of these issues, see:
http://allenbrowne.com/ser-03.html

--
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.

"RICHARD BROMBERG" <no*****@att.ne t> wrote in message
news:YT******** ************@bg tnsc05-news.ops.worldn et.att.net...
I have a table (tblPhone) with text fields FULL, LAST, PHONE,

I also have a combo box (cmboFull) .
The row source for cmboFull is SELECT DISTINCT [FULL] FROM tblPhone;

Here's the code for the combo box

Private Sub cmboFull_AfterU pdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Cl one
rs.FindFirst "[Full] = '" & Me![cmboFull] & "'"
Me.Bookmark = rs.Bookmark
This combo box populates ok but when I click on any item in the combo box I
get the following error on the "Set rs = Me.Recordset.Cl one" statement.
Run time error '91'
Object variable or Withblock variable not set.

I used similar code in another program and it worked fine so I am puzzled why it fails here.

Any ideas

The overall objective is to present a combo box containing the data in the FULL field and
then set a couple of text boxes with the LAST and FULL fields in the
selected record.


Jun 5 '06 #3
Is this a bound form, i.e. does it have something in its RecordSource
property?

If the source is an Access table (or a query or SQL statement that uses
Access tables), you may need to change the declaration of:
Dim rs As Object
to:
Dim rs As DAO.Recordset
and make sure you have a reference to the DAO library. The reference is
present in all versions of Access except 2000 and 2002, so if you are stuck
on one of those versions, see:
http://allenbrowne.com/ser-38.html

--
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.
"RICHARD BROMBERG" <no*****@att.ne t> wrote in message
news:kO******** *************@b gtnsc04-news.ops.worldn et.att.net...
Allen

I changed the code, removing the 2nd dot as you suggested, but that
generated the following error:
"You entered an expression that has an invalid reference to the
RecordsetClone property"

What else could be causing it.
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message
news:44******** *************** @per-qv1-newsreader-01.iinet.net.au ...
Try without the 2nd dot, i.e.:
Set rs = Me.RecordsetClo ne

There are several other things that could go wrong with that code,

including
reference priorities, the need to test NoMatch, and weird messages if the
record cannot be saved to activate the move (e.g. "Cannot Update without
Edit first".) For an example of a FindFirst that takes care of these

issues,
see:
http://allenbrowne.com/ser-03.html

"RICHARD BROMBERG" <no*****@att.ne t> wrote in message
news:YT******** ************@bg tnsc05-news.ops.worldn et.att.net...
>I have a table (tblPhone) with text fields FULL, LAST, PHONE,
>
> I also have a combo box (cmboFull) .
> The row source for cmboFull is SELECT DISTINCT [FULL] FROM tblPhone;
>
> Here's the code for the combo box
>
> Private Sub cmboFull_AfterU pdate()
> ' Find the record that matches the control.
> Dim rs As Object
> Set rs = Me.Recordset.Cl one
> rs.FindFirst "[Full] = '" & Me![cmboFull] & "'"
> Me.Bookmark = rs.Bookmark
>
>
> This combo box populates ok but when I click on any item in the combo box > I
> get the following error on the "Set rs = Me.Recordset.Cl one" statement.
> Run time error '91'
> Object variable or Withblock variable not set.
>
> I used similar code in another program and it worked fine so I am puzzled > why it fails here.
>
> Any ideas
>
> The overall objective is to present a combo box containing the data in the > FULL field and
> then set a couple of text boxes with the LAST and FULL fields in the
> selected record.

Jun 5 '06 #4

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

Similar topics

4
4273
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of Agency Types, then the 2nd combo box displays a list of Organisations, depending upon the Agency Type Selected. The first combo box 'ctlType' (Unbound), Row Source: to field in 'AgencyReferralType'.
1
4147
by: Jeff Smith | last post by:
Hi This is a repost due to no responses Here's a problem I've encountered with Access 2003 which has got me to redesign how I get the row source in a second combo box using the first combo box as a filter. In Access 2002 and earlier the row source for the second combo was "SELECT Field1, Field2 etc, FROM MyTable WHERE Field3 =
9
6753
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the second combo to change depending on what values the user selects in the first box, it's just that every time the user changes the first combobox, the second combobox FOR EVERY RECORD goes blank.
7
1842
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table in a different dataset. One combo box is displaying the Employees payroll ID. The other is
1
3094
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is ultimately driven by the results of two combo boxes: 1st combo box on main form that filters desired results for 2d combo box on sub form Main form: no record source. Has an unbound combo box. name: frminput combo name: cboAccounts The row...
4
2359
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. The idea behind the database is for a user to search/ select desired information in any kind of combination between the 4 combo boxes. Then the user clicks a button (btnSearch) and subsequently a query ("Search Function") is run that shows all 4...
2
7044
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small database I wrote for home, the combo boxes and listboxes no longer display the bound column. For example, on a form I have a combo box based on a table called 'names'. The two columns in the combo box are ID and Surname. The combo box and list box...
3
1976
rhitam30111985
by: rhitam30111985 | last post by:
Hi all.. i am trying to create a combo with the pop down list being modfied in real time as i type each character : import gtk window=gtk.Window(gtk.WINDOW_TOPLEVEL) window.connect("destroy",gtk.main_quit) combo=gtk.Combo() combo.set_use_arrows(True) wordlist= def entry_callback(widget,combo):
6
1868
by: =?Utf-8?B?amVmZmVyeQ==?= | last post by:
i need help with a combo box and this same code works on my first tab with a combo box. The error or problem i have is this code causes an index out of range error when i run it on my second combo box: (errored code) Select Case ComboBox2.text Case Is ="Execute Program" 'code to execute program here Case Is ="Other Command that executes code at a certain time" ' code below the same as above except that it works But not my first(this...
3
2991
by: evenlater | last post by:
Using Access 2007, I've found that combo box back colors change to transparent from normal inconsistently for no reason I can discern. Never had that problem in previous versions of Access. I do have the back style properties set to Normal and back colors set to white, but sometimes when I tab out of a particular combo box the back color changes to match the back color of the detail section. Has anybody else had this experience? Is there...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8751
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8539
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2759
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.