473,385 Members | 1,564 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.

Using dlookup to auto populate a form field?

I am working on a form to add entries into my assets table. I am trying to figure out how to make a purchase price field auto populate after entering model number into a combo box. There maybe a much simpler way to do this but here is what I have:


Private Sub Combo_Model_Exit(Cancel As Integer)

Dim varPrice As Variant
varPrice = DLookup("PurchasePrice", "tblModelInfo", "ModelNumber = [combo_model]")
If (Not IsNull(varPrice)) Then Me![PurchasePrice] = varPrice

End Sub


I have all my models and prices in a seperate table called ModelInfo. The only two fields in that table are ModelNumber and PurchasePrice. It seems like there should be a way to do this with the combo box and not dlookup. My combo box currently has both colomus of the ModelInfo table (ModelNumber being the unique identifier). BTW this is the first thing I have tried to do in VB in about 4 years so please keep it kinda simple. Thanks!
Apr 5 '07 #1
2 2591
Nevermid, I figured it out. I had a name wrong - user error. This is a great site BTW. :)
Apr 5 '07 #2
Killer42
8,435 Expert 8TB
Nevermid, I figured it out. I had a name wrong - user error. This is a great site BTW. :)
Yeah, we're pretty amazing. Solved that one for you without even trying. :D

Seriously, it's good to see you've resolved your problem. Hope you'll stick around in case you can answer any others.
Apr 6 '07 #3

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

Similar topics

1
by: John Hargrove | last post by:
I am building a database to manage test samples in an environmental laboratory. I am learning Access as I go and don't know much about the programming aspects. I hope to make the application...
5
by: Don Sealer | last post by:
Can I have this function look up more than one other field? For instance, I have a lookup now that does this: Me!Casting = DLookup("", "Part# Table", " = '" & Me!PartID & "'") What this does is,...
6
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
1
by: John Phelan-Cummings | last post by:
I'm not certain if this made the post. Sorry if it's a repeat: Using a Button to take an autonumber from one form to populate another autonumber field on another form. I have a Mainform "A"...
1
by: Parasyke | last post by:
I have a form (I won't bore you with the details of the necessity of this, but), I need to have a textbox that uses DLookup to get a value from a table with both being keyed to a common field...
2
by: boyleyc | last post by:
Hi all the following code works perfectly well. Basically it populates a series of check boxes on my form, depending on whether dlookup finds an associated record. The problem i have is that...
3
by: jacklindsay | last post by:
Hello smarter people than me I am creating a database for college, and have requested some help, but they are unable to help me. ( im obviously too eager) anyway, im creating a database on...
106
by: bonneylake | last post by:
Hey Everyone, Well i don't know if my question should be in javascript/ajax or coldfusion, i figure this is more of a coldfusion question. But if this is in the wrong section let me know an all...
2
by: paulyXvpf | last post by:
Hi All, FACTS: > I've created a VB.NET 2005 form, with a SQL Server 2000 backend > The form has about 30 fields that populate 30 columns in the SQL database > The form has mostly text feilds,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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.