473,770 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

strange Combo Behavior

I have a simple form with a combo box on top and then when a record is
chosen the remaining 3 fields from the table on the form.

My problem is that if I open the form on its own, all is fine. I see
the record I wanted and when I change the record in the drop-down, the
data fields that go with that record are displayed.

HOWEVER, when I open the form as the result of the user double-clicking
a record from the main form's list box, that chosen record is displayed
fine, but the drop-down box doesn't work anymore! If I choose another
ad from the combo-box drop-down, that ad shows in the combo, but the
data on the bottom of the form never changes.

I have no idea why this is happening, and didn't see any similar posts.
Maybe I have something set up in the form wrong?

Code:
Form:
Private Sub cboChooseAd_Aft erUpdate()

' User can choose an Ad to view (if double click from Main form, shows
that ad)
' Find the record that matches the control.

Dim rs As Object
Dim lngAdKey As Long

lngAdKey = Me.cboChooseAd

Set rs = Me.Recordset.Cl one
rs.FindFirst "[AdKey] = " & lngAdKey
Me.Bookmark = rs.Bookmark

End Sub
Callling form:
If IsNull(Me.lstAd s.Column(0)) Then
MsgBox "Please choose an ad to view", , "Ads - Choose an Ad"
GoTo Err_lstAds_DblC lick
Else
lngAdKey = Me.lstAds.Colum n(0)
End If

strLinkCriteria = "[AdKey]=" & lngAdKey

strDocName = "frmAdDetai ls"
DoCmd.OpenForm strDocName, , , strLinkCriteria

Forms!frmAdDeta ils.cboChooseAd = lngAdKey
HELP!!!
Thanks
sara

May 19 '06 #1
2 1509
"sara" <sa*******@yaho o.com> wrote in
news:11******** **************@ j55g2000cwa.goo glegroups.com:
I have a simple form with a combo box on top and then when a
record is chosen the remaining 3 fields from the table on the
form.

My problem is that if I open the form on its own, all is fine.
I see the record I wanted and when I change the record in the
drop-down, the data fields that go with that record are
displayed.

HOWEVER, when I open the form as the result of the user
double-clicking a record from the main form's list box, that
chosen record is displayed fine, but the drop-down box doesn't
work anymore! If I choose another ad from the combo-box
drop-down, that ad shows in the combo, but the data on the
bottom of the form never changes.

I have no idea why this is happening, and didn't see any
similar posts.
Maybe I have something set up in the form wrong?
Code:
Form:
Private Sub cboChooseAd_Aft erUpdate()

' User can choose an Ad to view (if double click from Main
form, shows that ad)
' Find the record that matches the control.

Dim rs As Object
Dim lngAdKey As Long

lngAdKey = Me.cboChooseAd

Set rs = Me.Recordset.Cl one
rs.FindFirst "[AdKey] = " & lngAdKey
Me.Bookmark = rs.Bookmark

End Sub
Callling form:
If IsNull(Me.lstAd s.Column(0)) Then
MsgBox "Please choose an ad to view", , "Ads - Choose
an Ad" GoTo Err_lstAds_DblC lick
Else
lngAdKey = Me.lstAds.Colum n(0)
End If

strLinkCriteria = "[AdKey]=" & lngAdKey

strDocName = "frmAdDetai ls"
DoCmd.OpenForm strDocName, , , strLinkCriteria

Forms!frmAdDeta ils.cboChooseAd = lngAdKey
HELP!!!
Thanks
sara


When you open the form by double-clicking, the form's recordset
is filtered to include only the record(s) which meet the
criteria. You might want to open the form without the
strLinkCriteria parameter, but execute the findfirst method
after the form opens

DoCmd.OpenForm strDocName '<--------existing

Dim rs as recordset
Set rs = Forms!frmAdDeta ils.Recordset.C lone
rs.FindFirst "[AdKey] = " & lngAdKey
Forms!frmAdDeta ils.Bookmark = rs.Bookmark

Forms!frmAdDeta ils.cboChooseAd = lngAdKey '<--existing

--
Bob Quintal

PA is y I've altered my email address.
May 20 '06 #2
Got it! Thanks so much for the help. It took me a while, but all is
working now.

Sara

May 23 '06 #3

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

Similar topics

5
3322
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the main form is reactivated following opening and closing a modal form. Strangely, this was not a problem until I started using my Access 2000 db in Access 2003 (as an Access 2000 db). Details follow... I have an unbound combo box on my main form...
0
1212
by: Jonathan LaRosa | last post by:
This is wierd: A client of mine has a combo box on a form that has a list of school names. She has found a wierd error when she tries to search for a specific school. She is trying to type in "Communal School of Boston" in the combo box. After she typed "Comm", the contents of the box showed "Comm. on School Reform", and the cursor was inserted just before the period, such that if she continued trying to type "Communal", the entry in...
3
1468
by: Karl Roes | last post by:
Hi All, I have a form with a standard combo box and 5 tabs in A2003. On Form Open, I set Me.Detail.Visible = False and in the after update event of the combo set Me.Detail.Visible = True,( to open form with no info showing ) I've noticed something quite strange. I open the form ( details are not visible ) select any record ID with the combo and the details come up OK. I click anywhere on the
1
1421
by: Edward | last post by:
I have encountered a combo box acting with a mind of its own in a VB.NET Windows app. I have a wizard consisting of a tab control; depending on which page is being displayed the tabs are added or removed. On page 1 of the wizard I have a combo box which is populated via its datasource using an array. I show page 1 and choose an item in the combo box (other than the 1st
4
1199
by: J L | last post by:
I am trying to use the following code to auto fill a combo box (credit and thanks to Code Project and Daryl) Public Sub AutoFillCombo(ByVal theCombo As ComboBox, ByVal theKey As Keys) Dim sTypedText As String Dim iFoundIndex As Integer Dim oFoundItem As Object Dim sFoundText As String
1
2024
by: Peter Proost | last post by:
Hi group I've got a usercontrol containing a textbox and alongside the textbox there's a combobox. I draw this control on top of a grid. So when the user clicks certain columns in the grid the control appears at the right place. This all works just fine except the z-order, at the beginning my usercontrol contained 2 comboboxes and the z-order was ok. But as I said before now it's a textbox and a combobox and since I've changed one of the...
8
2203
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 Product where as the Row Source (See properties): SELECT tblProducts.ProductName, tblProducts.ProductName FROM tblProducts ORDER BY ProductName;
1
1630
by: John Kreps | last post by:
I've tried to get combo boxes to work with Access 2007 for days now without success. What I can't get to work is the autocomplete. I've got three simple tables and one form with two controls. Initially, the autocomplete works. However, after exiting and restarting access, the autocomplete stops. If I type in a valid record/entry, access says item not in list. But, I can select the same record/entry in the drop down without getting an...
2
3743
by: scdowney | last post by:
First and foremost, thank you in advance for any attempts to help me out. I am working on a project with work, and it requires I use CSS selectors to locate elements within a webpage. For the most part, I have had no issues using the selectors, but I am having a very strange issue which does not seem to make much sense to me. Please advise if you have any input at all. Note, I am keeping this description at a high level for now because I...
0
9454
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
10260
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
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
10038
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
8933
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
6712
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();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.