I am very new at this. I have written a few functional databases, but everything i have learned has mostly come from this website.... so bear with me. I am trying to get information to automatically update. In the scenario i am using 2 tables. I have a part_number_table and a receiving_table. All of the part numbers and the descriptions are in the PN_table. The receiving_form is to assign a date, vendor, purchase order number, ect to the rec_table. What i need is .....
I have the part number on the rec_form coming from the pn_table from a combo box. When the pn is chosen i would like to have the description automatically filled in on the rec_form , from the pn_table, using on lost focus. I know it can be done, but i am extremely lost. How do i compare the number entered on the rec_form, to a number on the pn_table, and then enter the description from the pn_table on the rec_form.
Please help (the company i work for has told me to take an access class, but that has not occured yet)
5 2649
You don't give me much to work on, so I'll make several assumptions. Substitute your own values where required: - Private Sub cboPN_LostFocus()
-
Dim varDescription As Variant
-
-
If Not IsNull(Me![cboPN]) Then
-
'If the Part Number is a String
-
varDescription = DLookup("[Description]", "PN_Table", _
-
"[Part_Num] = '" & Me![cboPN] & "'")
-
'If the Part Number is Numeric
-
varDescription = DLookup("[Description]", "PN_Table", _
-
"[Part_Num] = " & Me![cboPN])
-
Forms!rec_form![txtDescription] = varDescription
-
End If
-
End Sub
NeoPa 32,556
Expert Mod 16PB
I'd consider using the AfterUpdate event in place of the LostFocus one for better results.
I agree! You really don't want the code running if the user simply tabs thru the combobox, which LostFocus would do, especially if the combobox has no item selected. A Null value would pop an error, I believe.
Also, crazyhorse, in the future please take the time to come up with a thread title that gives members a general idea of your problem. Since this is an Access/VBA forum, the title "VBA Access" really doesn't say much.
Welcome to Bytes!
Linq ;0)>
thank you for your help, i did end up using afterupdate, and i ended up using a subform on my for that is hidden. One day i will get better at this.
Of course you will! Glad you got it working!
Linq ;0)> Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steve |
last post by:
I have an unbound combobox in the form header of a continuous form. The
selection in the combobox sets the where clause in a querydef which determines
QryPFrmInventoryManagement. The following code...
|
by: Sherwood Botsford |
last post by:
Table Markers
ID (Primary Key)
This&That
PointClass (Combo box)
Points
Table PointClasses
PointClass (primary key)
Points (number)
Description (Text)
|
by: Geoff Portbury |
last post by:
I'm a swimming club coach.
I have a data base for recording times at various meets.
I have a FORM for entering times called SWIM TIMES.
When I enter the swimmers name ID, eg FOR01 for Doug Ford I...
|
by: Jeremy Dillinger |
last post by:
I have a program setup to pull data from a database. My database table has
things such as (category, Item, price, etc.) In my program I want to have
multiple list boxes that will have a pull down...
|
by: grummanf6f |
last post by:
Hello Gurus,
this probably is real simple for you but for me it's a bummer.
I have one table in which I have basic data collected of schools. I
have another data that is detailed info on the...
|
by: Magnus |
last post by:
Im using a set combobox (ComboBox1) to provide a selection of records from a
database table. I have a typed dataset (DataSet1) that contains the typed
datatable (DataTable1) that the combobox is...
|
by: jujubean |
last post by:
I have a form with five comboboxes. In the first, the user can select
one of four items. The other four comboxes are hidden. Based on the
selection made in combobox one, I would like one of the...
|
by: peasedm |
last post by:
Okay this one has me stumped. I have a table called Review_Statements
with the following columns:
statementid
type
statement1
statement2
statement3
I have a form called SR_Review with an...
|
by: Brett_A |
last post by:
I have a form where the first field is a dynamic drop-down that pulls
from a db (Access). The fields associated with the query are task_id,
task_name and task_rate. The field has the value of...
|
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: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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?
|
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...
|
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...
|
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,...
| |