Talk About Network

Google





Software > Access Forms > Re: Default Val...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 10 Topic 46506 of 46786
Post > Topic >>

Re: Default Values based on Value in another Table

by =?Utf-8?B?QWxiZXJ0bw==?= <Alberto@[EMAIL PROTECTED] > Dec 3, 2008 at 04:55 PM

I figured it out.  I was pointing to the Model field which was a text
instead 
of pointing to the ModelID which was a number field.  Thanks for your
help.

"Allen Browne" wrote:

> So if yuo open your table in desigtn view, what Type is ModelID?
> 
> If it is Text (not Number), you need extra quotes:
>     strWhere = "ModelID = """ & Me.ModelID & """"
> 
> Explanation:
>     Quotation marks within quotes
> at:
>     http://allenbrowne.com/casu-17.html
> 
> -- 
> Allen Browne - Microsoft MVP.  Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
> 
> "Alberto" <Alberto@[EMAIL PROTECTED]
> wrote in message
> news:84131FA3-655B-43A5-90DB-4C01011A3BF4@[EMAIL PROTECTED]
> >I still received the same error.  This time in this line:
> > varResult = DLookup("ModelRetailCost", "Table 1", strWhere)
> >
> > I also tried doing it this way:
> >
> > Private Sub ModelRetailPrice_AfterUpdate()
> > DLookup("ModelretailPrice","tblModel", "ModelID = '" &
> > Forms![frmQuotes]!ModelID & "'")
> > End Sub
> >
> > but when I did, nothing happened.
> >
> >
> >
> >
> > "Allen Browne" wrote:
> >
> >> Try breaking it down  into steps, to see where the problem lies.
> >>
> >> This kind of thing:
> >>
> >> Dim strWhere As String
> >> Dim varResult As Variant
> >>
> >> If Not IsNull(Me.ModelID) Then
> >>     strWhere = "ModelID = "& Me.ModelID
> >>     varResult = DLookup("ModelRetailCost", "Table 1", strWhere)
> >>     If Not IsNull(varResult) Then
> >>         Me.ModelRetailCost = varResult
> >>     End If
> >> End If
> >>
> >> "Alberto" <Alberto@[EMAIL PROTECTED]
> wrote in message
> >> news:A16CDDA2-9736-4F1F-92D9-ABE38BC72643@[EMAIL PROTECTED]
> >> > Thanks.  I think I'm almost there.
> >> >
> >> > I typed the following into my form:
> >> > Forms![frmQuotes]!ModelRetailCost = DLookup("ModelRetailCost",
"Table 
> >> > 1",
> >> > "ModelID = " & Forms![frmQuotes]!ModelID)
> >> >
> >> > When I ran this I got the following error: Data Type Mismatch in 
> >> > Criteria
> >> > Expression.
> >> >
> >> >
> >> >
> >> >
> >> > "Allen Browne" wrote:
> >> >
> >> >> Use the AfterUpdate event procedure of Textbox1 to DLookup() the
price 
> >> >> of
> >> >> the ModelID in Table2.
> >> >>
> >> >> For an example, see the Northwind sample database. In the Order 
> >> >> Details
> >> >> subform, the ProductID combo has this kind of AfterUpdate event 
> >> >> procedure
> >> >> to
> >> >> get the price each from the Products table.
> >> >>
> >> >> If you need help with DLookup(), see:
> >> >>     Getting a value from a table: DLookup()
> >> >> at:
> >> >>     http://allenbrowne.com/casu-07.html
> >> >>
> >> > "Alberto" <Alberto@[EMAIL PROTECTED]
> wrote in message
> >> >> news:7861EB88-C542-4378-9531-797D9F53AE00@[EMAIL PROTECTED]
> >> >> > Here's what I need to do:
> >> >> > Prompt the user to enter a ModelID in TextBox1 and have the
> >> >> > ModelRetailPrice
> >> >> > for that ModelID returned in TextBox2 - both the ModelID and
> >> >> > ModelRetailPrice
> >> >> > are in Table1.  Once the user does this they can enter data in 
> >> >> > TextBox3
> >> >> > and
> >> >> > TextBox4.  I then want TextBox1, TextBox2, TextBox3 and TextBox4
to 
> >> >> > be
> >> >> > stored
> >> >> > in Table 2.  How do I do this?
> >>
> >> 
> 
>
 




 10 Posts in Topic:
Default Values based on Value in another Table
=?Utf-8?B?QWxiZXJ0bw==?=   2008-12-02 17:12:01 
Re: Default Values based on Value in another Table
"Allen Browne"   2008-12-03 10:19:26 
Re: Default Values based on Value in another Table
=?Utf-8?B?QWxiZXJ0bw==?=   2008-12-02 18:28:05 
Re: Default Values based on Value in another Table
=?Utf-8?B?QWxiZXJ0bw==?=   2008-12-02 19:07:00 
Re: Default Values based on Value in another Table
"Allen Browne"   2008-12-03 14:24:43 
Re: Default Values based on Value in another Table
=?Utf-8?B?QWxiZXJ0bw==?=   2008-12-03 03:43:06 
Re: Default Values based on Value in another Table
"Allen Browne"   2008-12-03 21:19:12 
Re: Default Values based on Value in another Table
=?Utf-8?B?QWxiZXJ0bw==?=   2008-12-03 04:36:02 
Re: Default Values based on Value in another Table
"Allen Browne"   2008-12-03 23:46:05 
Re: Default Values based on Value in another Table
=?Utf-8?B?QWxiZXJ0bw==?=   2008-12-03 16:55:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 15:50:13 PST 2009.