473,399 Members | 3,302 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,399 software developers and data experts.

Combo Boxes in a Form change when entering new data

I have a form with fixed list boxes which are of the persons name and address. Below those, I have Combo Boxes so I can manually enter data like phone number, email, etc. If the information is already there, I simply review and print the Report. If not, I add the data.

My problem is that after I manually enter data into a Combo Box, upon selecting the next Combo Box, the fields (All of them) change. What seems to happen is that the form reverts to the first listing (alphabetical) rather than allowing me to simply continue filling out the information I need. So I am having to enter data in one box and then I have to scroll back thru the listings, find the selction I want to work with, enter more data, and repeat for each Combo Box.

Is there a way to keep the form from changing so I can remain on the selection I want, fill out the blanks (or make changes) and go to the report?

Note: Most fields from the Combo Boxes are blank in the table and they will change often.

Thanks.
Jun 18 '10 #1
11 1921
jimatqsi
1,271 Expert 1GB
What events are coded to do some action? Something in the After_Update event of each textbox?

Jim
Jun 18 '10 #2
Private Sub Combo40_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Payment] = '" & Me![Combo40] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Jun 18 '10 #3
jimatqsi
1,271 Expert 1GB
So no wonder the combo boxes, and every other data item on the form, are changing when you change the value in the combobox. This code is going out to look for the first record that matches the [Payment] to the entry in the combo box. If all the combo boxes have similar logic, then every time you change any combo box the form possibly changes to a different record.

You want this sort of code only on the combo box that you are using to look up a record; after you look up the record you want to edit it without switching to a different record. Your lookup combo box should not really be bound to the record being looked up, it should be an unbound object.

Jim
Jun 18 '10 #4
I've literally just begun teaching myself Access. Can you suggest what the code should read? Please?
Jun 18 '10 #5
jimatqsi
1,271 Expert 1GB
What version of Access are you working with? There should be a sample database loaded on the system, it was loaded automatically with Access. It's called Northwinds.mdb. That has a lot of sample code, some of it illustrating just what you are trying to do here.

The first thing to change is to change the properties of the combo boxes that you search with. They should not have any data source, that binds the box to the data record, so when you change the record, the combo box changes. Make some text boxes and bind those to the data source.

Just based on what you have so far, it seems you made good progress teaching yourself. But spend some time reviewing the code in the NW database, there's a ton of good stuff there.

Don't worry, we're here to help when you get stuck. :)

Jim
Jun 18 '10 #6
@jimatqsi
Thanks. Now that I have replaced everything with a text box, I am able to fill out the form properly and it doesn't change like before.

BUT........... Now the report is not showing the information I put into the form? The data is being stored tho.
Jun 21 '10 #7
Edit: If I scroll away from the latest information added or edited and then come back to it, everything prints to the report as it should. However, if I simply go to the report immediately, the information is not shown.... Hmmmmmmmmmmmm.
Jun 21 '10 #8
jimatqsi
1,271 Expert 1GB
Are you saying you can still use your combo boxes to look up a given record, and that works okay now? Have you gone into the table itself to verify that the table is being updated as it should? Sounds like you did that.

If you have andif the data is correct, maybe you should start a new thread for your reporting problem. Give some details about what you are trying to report and what is happening with it. But tell us either way if the table is looks like it should.

Jim
Jun 21 '10 #9
@jimatqsi
Sorry for the confusion. No, I erased all the combo boxes and such and simply did a drag-n-drop from the Field List to use text boxes as you suggested. It allows me to edit the information stored in the table without changing on me.

I went in a chacked the table and sure enough, all the data is being stored. But unless I literally "scroll" to another entry and back, the report will not print the current (newly added info) selection. Or if I close and re-open the form. Almost like when I click the button to preview the report, the form isn't being refreshed to recognize the new data.

Sorry to say, I was not able to discover something you experts are unaware of... :)
Jun 21 '10 #10
jimatqsi
1,271 Expert 1GB
Very good, FaurKris. It just sounds like you need to write the last changes prior to launching the report. Add this just before the code that launches the report

Expand|Select|Wrap|Line Numbers
  1. if me.dirty then me.dirty=false
That says if the form has been changed then update the database with the change.

Jim
Jun 21 '10 #11
@jimatqsi
PERFECT! Thanks a bunch!
Jun 21 '10 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Joyce | last post by:
The XML Schema design problem to solve is as follows: We have 2 combo boxes to populate from schema data, let's say: 1. States 2. Cities (and this one gets populated depending on the choice of...
3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
1
by: Anonymous | last post by:
Quick question - I have a form with with many fields on it. I have three combo boxes that are used as search engines (Last Name, City, State). For example, when I open the form, all three search...
12
by: Nhmiller | last post by:
When I start to type the data for a new record, I would like a dropdown box to open next to it from which I can choose the data from a previously entered record that starts with the same letter....
1
by: alex | last post by:
Hi, I am loading quite a large list into a datagrid and while doing so the form freezes... and for 10-20 seconds i have quite a messy screen. e.g. the file chooser half deleted and still half...
4
by: Miguel | last post by:
I have an order entry database with two forms. One is for new orders the other is to update orders. The forms are identical except that one is strictly order entry. On both forms are three sets of...
5
Dököll
by: Dököll | last post by:
Hey Fans! Perhaps you can help me... I am using MS Access 2003. I have tried a number of things to get rid of the text #Error from appearing on form fields when no data present. Tried the...
1
by: ghjk | last post by:
I have two questions. 1.I have to enter values to database through php. When I enter incorrect value, it gives the error message. But i want to give it as a pop up message. how can i do that? 2....
11
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo...
3
by: cheweedog | last post by:
I have a form that contains 1 subform. Everything works fine until I tab into a textbox in the bottom of the main form. The data in the subform disappears on the form, but the table is updated. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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,...
0
isladogs
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...

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.