473,385 Members | 1,642 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,385 software developers and data experts.

Auto Update Form Controls When Another Control is Updated

I have a form I use to log in sample with the Lab ID as the tables primary key. Currently I have this form open to the last record for entering new samples. However if I type in or select an existing lab ID I would like the other feilds to auto populate with the data for the lab ID. I have tried a Find Record command button but that gives me an error.

Thanks for any help.
Jan 10 '14 #1

✓ answered by BikeToWork

Make a combo box with the LabID as the rowsource. Create a procedure for the after_update event on the combo. In the event have the form find the record based on the selection in the combo box. Something like this should work.
Expand|Select|Wrap|Line Numbers
  1. Dim RSClone As DAO.Recordset
  2. Dim lngLabID as Long
  3.  
  4. Set RSClone = Me.RecordsetClone
  5.  
  6. If IsNull(Me.cboSearchLabID) Then
  7.     Exit Sub
  8. End If
  9.  
  10. lngLabID= Me. cboSearchLabID
  11.  
  12. RSClone.FindFirst "[ID ]= " & lngLabID
  13. If RSClone.NoMatch = False Then
  14.     Me.Bookmark = RSClone.Bookmark
  15. End If
  16.  
  17. Set RSClone = Nothing
  18.  

9 1393
Rabbit
12,516 Expert Mod 8TB
If Lab ID is supposed to be the unique primary key, how can you use an existing Lab ID? That's contradictory.
Jan 10 '14 #2
I dont want to use an exsiting lab ID. But if I select an exsisting one I would like the other feilds to populate with the data for that one, for editing mistakes etc,.
Jan 10 '14 #3
BikeToWork
124 100+
It sounds like an unbound form. Is that the case? If the form is data-bound, the other fields should also populate when you go to an existing LabID.
Jan 10 '14 #4
It does automatically populate the other feilds when I use the nav buttons, but this will not be feasible. I need to be able to type in and/or select the Lab ID and have it do it as well.
Jan 10 '14 #5
BikeToWork
124 100+
Make a combo box with the LabID as the rowsource. Create a procedure for the after_update event on the combo. In the event have the form find the record based on the selection in the combo box. Something like this should work.
Expand|Select|Wrap|Line Numbers
  1. Dim RSClone As DAO.Recordset
  2. Dim lngLabID as Long
  3.  
  4. Set RSClone = Me.RecordsetClone
  5.  
  6. If IsNull(Me.cboSearchLabID) Then
  7.     Exit Sub
  8. End If
  9.  
  10. lngLabID= Me. cboSearchLabID
  11.  
  12. RSClone.FindFirst "[ID ]= " & lngLabID
  13. If RSClone.NoMatch = False Then
  14.     Me.Bookmark = RSClone.Bookmark
  15. End If
  16.  
  17. Set RSClone = Nothing
  18.  
Jan 10 '14 #6
zmbd
5,501 Expert Mod 4TB
blpierce76:
Hello there, as a chemist I have an idea as to what you might be wanting (^_^)

We need to make sure that your database is normalized. From what I've read so far it may not be, or is not normalized far enough.
Please read thru: > Database Normalization and Table Structures.
Jan 10 '14 #7
Bike to Work,

That worked well, but is there a way now that if I enter a new LabID to have the rest of the form go blank, or to a new record?
Jan 10 '14 #8
Thanks for that link zmbd.

But unlike you, this chemist may be outta his league with this database stuff. LOL.

Thanks for the help.
Jan 10 '14 #9
zmbd
5,501 Expert Mod 4TB
Because we don't know the structure of the database and the form(s) you're using, the answer to your second question is - "more than likely yes."

However, we do try to keep to one topic per thread; thus, please start a new post (or search here on Bytes.com first (^_^) ) Please include a link back to this thread for context if needed.

As for
However, "this chemist may be outta his league" we're not out of your abilities.... there's the minors! ((^_^))

If you need help normalizing the database, please start a new thread. We don't mind helping thru the rough spots; thus, if you show your work, we can maybe provide some guidance to help with the design. I know that I occationally need that help when starting a new database... even if it's just to proof-read the schema!
Jan 11 '14 #10

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

Similar topics

0
by: Jerry Brenner | last post by:
Our users have potentially dirty legacy data that they need to get into our application. We provide a set of staging tables, which map to our source tables, that the users do their ETL into. ...
3
by: vonclausowitz | last post by:
Hi Everyone, Is it possible to create some code which can automatically update my forms formatting? I have a small database with a form which is periodically changed. When the db is returned to...
1
by: ainsley | last post by:
Hi this is going to sound like a very basic question, but I am creating a database in Access which is based on a number of unlimited tables. In my data entry form i have a number of combo boxes...
1
by: Phil | last post by:
Hello, I have a sales form, order details, that shows Product ID, quantity, Unit Price, etc. I have a Products table, Products, that has Product ID, Stock Level, Unit Price. What i would like...
1
by: Rodney Frisard | last post by:
Can anyone help me get this working. table1 has 3 field, CustId, CustName, CustRate table2 has 7 fields TimeId, TimeCustId, TimeCustName, TimeDate, TimeStartTime, TimeEndTime, TimeCustRate,...
1
by: mdk7 | last post by:
I am very new to developing forms and queries with Access. The task that I am required to complete is as follows: Build a form based user interface that displays various information from the...
2
by: mxdllc | last post by:
i would like to create an admin panel for my business. because i have 5 or 6 suppliers and to order i have to lookup which supplier it is then find the url, so to make things a little easier im going...
0
by: Agnes | last post by:
I try the auto-update program from IIS - http://sourceforge.net/projects/appupdater It works find in window2003 However, when I do the same procedure and setup in window 2000 IIS 5.0 it is fail...
11
by: PaulaCM | last post by:
I am trying to create a field in my Access 2007 form where, when you modify anything in the form it updates the date. In other words, I have a "Date Update" field that I need to automatically...
1
by: kamalhasnainee | last post by:
I have solved my previous Problem.............. Now I have a new problem.. please see below... TextBox Auto update I have two table like "Employees" Table Fields:
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?

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.