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.
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. -
Dim RSClone As DAO.Recordset
-
Dim lngLabID as Long
-
-
Set RSClone = Me.RecordsetClone
-
-
If IsNull(Me.cboSearchLabID) Then
-
Exit Sub
-
End If
-
-
lngLabID= Me. cboSearchLabID
-
-
RSClone.FindFirst "[ID ]= " & lngLabID
-
If RSClone.NoMatch = False Then
-
Me.Bookmark = RSClone.Bookmark
-
End If
-
-
Set RSClone = Nothing
-
9 1393
If Lab ID is supposed to be the unique primary key, how can you use an existing Lab ID? That's contradictory.
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,.
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.
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.
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. -
Dim RSClone As DAO.Recordset
-
Dim lngLabID as Long
-
-
Set RSClone = Me.RecordsetClone
-
-
If IsNull(Me.cboSearchLabID) Then
-
Exit Sub
-
End If
-
-
lngLabID= Me. cboSearchLabID
-
-
RSClone.FindFirst "[ID ]= " & lngLabID
-
If RSClone.NoMatch = False Then
-
Me.Bookmark = RSClone.Bookmark
-
End If
-
-
Set RSClone = Nothing
-
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.
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?
Thanks for that link zmbd.
But unlike you, this chemist may be outta his league with this database stuff. LOL.
Thanks for the help.
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!
Sign in to post your reply or Sign up for a free account.
Similar topics
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. ...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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:
|
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...
|
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...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |