473,395 Members | 1,696 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.

recordsource error


Hi. I have a contacts form with an unbound dropdown box and a bunch of
bound controls relating to the contact. When I load the form, I want all
the controls to be empty until I select a name from the dropdown. this
works except that as expected, all the bound controls have #Name? in
them when the form loads until I select a name. the controls are then
bound and the record displays properly.

How I can do this without getting the #Name? error?

thank you

Colin
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
5 2469
Make the entire form unbound, then bind it only after the selection is
made in the combo box. You can leave the binding for individual controls
intact - it will work when you provide the proper record source.

Pavel

ColinWard wrote:

Hi. I have a contacts form with an unbound dropdown box and a bunch of
bound controls relating to the contact. When I load the form, I want all
the controls to be empty until I select a name from the dropdown. this
works except that as expected, all the bound controls have #Name? in
them when the form loads until I select a name. the controls are then
bound and the record displays properly.

How I can do this without getting the #Name? error?

thank you

Colin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
Hi Pavel. thanks for your reply. I tried doing as you suggested by
removing the form's recordsource but I still got the error. It still
worked after I seleccted a name from the dropdown. do I have to set each
individual control's recordsource to null or was the way I did it the
correct way?

Thanks for your help

Colin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
Colin,
I am sorry, I sent you down the wrong path :-(
Try setting the recordsource to return zero records when the form first
opens, like

SELECT * FROM SourceTable WHERE False

Don't forget to change it back later :-)
Pavel

ColinWard wrote:

Hi Pavel. thanks for your reply. I tried doing as you suggested by
removing the form's recordsource but I still got the error. It still
worked after I seleccted a name from the dropdown. do I have to set each
individual control's recordsource to null or was the way I did it the
correct way?

Thanks for your help

Colin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4

Thanks Pavel!!!

It works perfectly.

Now I have another question. this one is quite complicated but I will
see if I can explain.

I have two textboxes on my contacts form which are unbound. The first of
these is a list of products which the current contact is interested in
and the second listbox is a description of the product that is currently
selected in the first listbox. When I press the insert key on the
products listbox, another form pops up which allows me to select all the
products which the current contact is interested in. I then click a
button on the form and the selected products are transferred to the
first listbox on the contacts form via an SQL statement. then if I
select any of these newly added products, the proper description is
displayed. The problem comes when I try to delete any of the products
from the contact. The problem is that the second listbox gets its data
from a different table than the first listbox and I use the column
property to populate the second listbox. when I delete a product, the
product description is not deleted but I do not want it to be because
the description comes from the products table itself, whereas the
products are added to an Add Products to Contacts table. I hope this
makes sense.

here is the query that populates the first listbox.
---
SELECT [Products by Contact Query].ContactID, [Products by Contact
Query].ProductID, [Products by Contact Query].ProductName,
Products.ProductDescription FROM [Products by Contact Query] INNER JOIN
Products ON [Products by Contact Query].ProductID=Products.ProductID;
----
and here is the code that provides the description of the selected
product.

Private Sub LstContactProducts_AfterUpdate()
txtProductDescription.SetFocus
txtProductDescription.Value = LstContactProducts.Column(3,
LstContactProducts.ItemsSelected)
LstContactProducts.SetFocus
End Sub

My question is simply this:

how do I delete the product description from the product given that the
list boxes are populated from two different source tables? I cannot
delete the product description directly as it is part of the Products
table and not part of the Add Products to Contacts table.
I hope this makes sense!!!

Thanks for all your all help Pavel

Colin



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5
Colin,

I don't see a problem pulling a description of the product from the
column of the listbox to put it into a textbox. It does not matter that
the data comes from another table because for the controls to work the
data is just the result of a valid SQL - the lis box doesn't care what
the cources of this SQL are.
I think the problem you are having can be remedied if:
1) you refresh the listbox after the item is deleted from the customer
items list (I suppose, in that pop-up form where you control the items
for the customers)
2) you force the update of txtProductDescription.Value not just in
LstContactProducts_AfterUpdate but also in the code where you are
removing items from the customers choices list.

Cheers,
Pavel

ColinWard wrote:

Thanks Pavel!!!

It works perfectly.

Now I have another question. this one is quite complicated but I will
see if I can explain.

I have two textboxes on my contacts form which are unbound. The first of
these is a list of products which the current contact is interested in
and the second listbox is a description of the product that is currently
selected in the first listbox. When I press the insert key on the
products listbox, another form pops up which allows me to select all the
products which the current contact is interested in. I then click a
button on the form and the selected products are transferred to the
first listbox on the contacts form via an SQL statement. then if I
select any of these newly added products, the proper description is
displayed. The problem comes when I try to delete any of the products
from the contact. The problem is that the second listbox gets its data
from a different table than the first listbox and I use the column
property to populate the second listbox. when I delete a product, the
product description is not deleted but I do not want it to be because
the description comes from the products table itself, whereas the
products are added to an Add Products to Contacts table. I hope this
makes sense.

here is the query that populates the first listbox.
---
SELECT [Products by Contact Query].ContactID, [Products by Contact
Query].ProductID, [Products by Contact Query].ProductName,
Products.ProductDescription FROM [Products by Contact Query] INNER JOIN
Products ON [Products by Contact Query].ProductID=Products.ProductID;
----
and here is the code that provides the description of the selected
product.

Private Sub LstContactProducts_AfterUpdate()
txtProductDescription.SetFocus
txtProductDescription.Value = LstContactProducts.Column(3,
LstContactProducts.ItemsSelected)
LstContactProducts.SetFocus
End Sub

My question is simply this:

how do I delete the product description from the product given that the
list boxes are populated from two different source tables? I cannot
delete the product description directly as it is part of the Products
table and not part of the Add Products to Contacts table.

I hope this makes sense!!!

Thanks for all your all help Pavel

Colin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #6

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

Similar topics

2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
4
by: ColinWard | last post by:
Hi. I use two different pieces of code to manipulate a recordsource for a form. The first one sets the recordsource to null when the form loads. The second is supposed to display the corresponding...
1
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
2
by: David Haskins | last post by:
I have a fairly complex interface screen (form) that is comprised of several subforms that perform different, but related activities. I am designing a search/filter form that should be able to...
3
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RecordSource of a Master Report is: Me.RecordSource = "TableOrQueryName"
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.