I am developing an order tracking database, which to keep this explanation simple, consists of 'Orders' table, 'Order Details' table, 'Deliveries' table & 'Inventory' table.
There are one-to-many relationships from Orders to 'Order Details, Orders to Deliveries and Orders to Inventory.
I have forms to enter and track customer orders and inventory transactions; these work fine but I am having difficulty getting a list-box control to work the way I want on the deliveries form.
I have created a bound split form using the forms wizard. The main form is bound to Orders and the subform bound to Inventory. The intention is to pick from Inventory, items for delivery.
I have added a list-box to the main form to display item order code and quantity from the Order details table. The query behind the list-box has a criterion to select from Order Details table where order number from Orders table equals the order number displayed in a text-box on the form. The difficulty I have is that this list-box does not update when I move between orders - It shows only the first Order Details data. Yet I have other text-boxes on the main form bound to the same Order Details table that do work as expected. Can someone help me get this part of the form working please.
12 1914
You did not provide any of your code, so I am guessing on this and using illustrative object names. What I am telling you to do is requery the listbox (located on the main (parent) form) when you move between orders. -
Private Sub OrderNumber_Change()
-
Me.Parent.YourListbox.Requery
-
End Sub
-
I did not post my code in case it lead people astray - I was hoping for an answer to the problem, not a fix for my clumsy code. I tried the code you provided - It looks like this: - Private Sub OrderNumber_Change()
-
Me.Deliveries.List27.Requery
-
End Sub
My code was similar - Private Sub OrderNumber_Change()
-
Me.List27.Requery
-
End Sub
The code is attached as an event to the OrderNumber text box. Neither of them work. There are no errors, no change in the list box, it just seems to ignore the code. Where do we go from here?
At this point, I think the most likely reason the requery did not work is that the syntax is incorrect. You stated that the listbox is on the main form, which I assume is named deliveries. If the order form is a subform of the main form and the code is placed behind the Ordersubform, the syntax would be as follows:
Private Sub OrderNumber_Cha nge() 'place code behind the OrdersSubform
Me.Parent.List2 7.Requery
End Sub
If this does not work, please list your forms and subforms by name, and state which one has the listbox and which one has the requery code.
example
MainForm Deliveries (has listbox)
Subform1 Orders (has requery code)
Subform2
Something else ....you need to place a control break in yourOrderNumber _Change proc to determine if it is firing.
Thanks for staying with this,,, In response to your last posting:
Main Form is named Deliveries
Main Form is bound to Transactions table
Main Form has Order Number text box named 'TransactionRef erence'
Main Form has Unbound list box named 'List27'
Subform is named 'Deliveries Subform'
Subform is bound to Inventory table
Richard,
I believe the code below should work, provided that the TransactionRefe rence_Exit() event is firing. I assume that this textbox is unbound, and therefore you can not use the change or afterUpdate events to fire the requery code. It should fire in the textbox's exit event if you are entering the OrderNumber into the TransactionRefe rence textbox. If you do not enter the OrderNumber in that textbox, please tell me where it is entered. -
Private Sub TransactionReference_Exit()
-
Me.List27.Requery
-
End Sub
-
Thanks again... I have tried the new code but still no joy.
To recap and expand on a couple of things...
The 'Deliveries' main form is bound to and reads data from the 'Transactions' table.
As I move from record to record, the order number (entered previously) in the 'TransactionRef erence' (bound) text box, changes.
The 'TransactionRef erence' text box is bound to the 'Transactions' table, 'TransactionRef erence' field.
'List27' (unbound) reads 'OrderCode' from the 'Order Codes' table and 'QtyOrdered' from the 'Transaction Details' table.
The 'Transactions' table has a one-to-many relationship with 'Transaction Details'
'Transaction Details has a one-to-many relationship with 'Order Codes'.
The criteria placed on 'List27 query is to select based on the value in the 'TransactionRef erence' text box on my form
The query code is listed here: - "
-
SELECT Transactions.TransactionReference, [Transaction Details].OrderCodeID, [Order Codes].OrderCode, [Transaction Details].QtyOrdered
-
FROM Transactions INNER JOIN ([Order Codes] INNER JOIN [Transaction Details] ON [Order Codes].ID = [Transaction Details].OrderCodeID) ON Transactions.ID = [Transaction Details].TransactionsID
-
WHERE (((Transactions.TransactionReference)=[Forms]![Deliveries]![TransactionReference]));
-
"
I have created a separate query using the code above and tested it by running the query after I move to the next record and the test query works just fine.
I think your code is good and I suspect that the event procedures are not firing (same on different computers). How can I test if they are? Your previous post said to put a control break into the code - I do not know how to do this. If we establish that the event procedures are not firing, how do we fix it?
I have taken a further look at event procedures in MSDN and I find that I have to type something into a text field before the 'On Change" event (or many other) works. After stumbling around with different event types I arrived at this:
Set the 'On Got Focus' event... - Private Sub TransactionReference_GotFocus()
-
Me.List27.Requery
-
End Sub
This will work but only if you click in the TransactionRefe rence text box after moving between records. So I added the following:
Set the main form 'On Current' event...
Private Sub Form_Current()
Me.TransactionR eference.SetFoc us()
End Sub
This forces the focus to return to the TransactionRefe rence text box after moving between records, which in turn re-queries the list box
Seems to work but is it the right solution? - Is there something more elegant that I should be using?
Richard,
The fact that you are not able to fire the change and AfterUpdate events is why I was trying to tell you in my previous post to try the Exit event. Quote from my previous post:"It should fire in the textbox's exit event if you are entering the OrderNumber into the TransactionRefe rence textbox. If you do not enter the OrderNumber in that textbox, please tell me where it is entered."
My question remains>>>>>> where/how do you orignate the change in the OrderNumber...v ia the listbox or via the textbox or how ??? The answer to this question will help determine if there is a more elegant solution. Even if there is a more elegant solution, congrats to you for finding a work around.
Seems like I didn't do a good enough job explaining how this database works. Just shows we need to test understanding at every stage - And thats with us using a common language.
The database has 3 functions
1 - Order Processing
2 - Inventory management
3 - Deliveries register
A customer order number is entered during order processing. This number is entered to the 'TransactionRef erence' field of the 'Transactions' table via an 'Orders' form.
When we come to deliveries, the 'TransactionRef erence' field is displayed on the 'Deliveries' form. The number in the text box on the 'Deliveries' form changes as I move from record to record but it is not entered or overtyped here.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrea |
last post by:
Hi,
I'm trying to emulate part of our client-server application as a web
site so customers can use it, and I'm stuck when it comes to
re-ordering items in a list.
Basically we have a list of available articles ("availableItems") and
a list of articles already in an issue ("selectedItems"). What I want
is to be able to move articles freely between the two lists and then
on submission add them to the issue (which I can), but also move...
|
by: James Baker |
last post by:
I have a form that has a dropdown list that will cause a post to the same
page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of themselves,
so to speak...but I didn't know if there was a simpler/more efficient way.
...
|
by: Rodney King |
last post by:
Hi,
I have developed an ASP page which dynamically displays a list of
checkbox options based on a SQL statement. Here is my code:
<div style="OVERFLOW:auto; Height: 150px">
<table>
<%
dim adOpenForwardOnly, adLockReadOnly
dim adCmdTable, ctr, checkboxID
|
by: James Fortune |
last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't
understand why people who know how to write code to completely replace
a front end do not write something that will automate the code that
implements managing unbound controls on forms given the superior
performance of unbound controls in a client/server environment. I can
easily understand a newbie using bound controls or someone with a
tight deadline. I guess I need...
|
by: Mark |
last post by:
Hi,
I have an aspx page, that in the PageLoad sub, gets values from a specific
record in a database as where the record id is retrieved from the
querystring. Thesee values are then used to populate a series of text boxes,
radio button selections and drop down list selections. This all works.
I run into a problem when I change the values of one of these populated
items. When a button is clicked to update the database with the modified...
| |
by: clinttoris |
last post by:
Hello,
If someone could help me it would be appreciated as I am not having
much luck.
I'm struggling with my asp code and have some questions relating to asp
and oracle database.
First question. I have a web survey that I am working on and have
successfully dynamically taken the info from a database, displayed it
on the screen and then taken the users answers and inserted them into a
|
by: nephish |
last post by:
Hey there all.
i have been looking to simplify my huge website that i wrote while
learning php.
now its a spaghetti mess. So, i wanted to simplify it.
Now, i see the functionality that defining functions can give me. But
what is the magic behind classes?
i mean, the documentation i find. Most use the class Person as the
example. So how would having a person class help me. It seems that i am
writing more code than less because i am...
|
by: MrHelpMe |
last post by:
Hello again experts,
I have successfully pulled data from an LDAP server and now what I want
to do is drop the data into a database table. The following is my code
that will insert the data but that has problems.
FullName=Request.Form("Name")
Email=Request.Form("Email")
GivenName=Request.Form("GivenName")
|
by: RMWChaos |
last post by:
In my ongoing effort to produce shorter, more efficient code, I have created a "chicken and egg" / "catch-22" problem. I can think of several ways to fix this, none of them elegant.
I want my code to declare var stop if it was not passed to the function. The problem is that stop would be equal to a value dependent on var index that has not been declared yet, but index cannot be created until stop is declared. So you see my chicken and egg...
|
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...
|
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,...
| |
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...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |