|
|
I have run the following "event procedure" from a combo box and am getting a "data type mismatch error: 3464"
Private Sub ModelRetailPrice_AfterUpdate() Forms![frmQuotes]!ModelRetailPrice = DLookup("ModelretailPrice", "tblModel", "ModelID = " & Forms![frmQuotes]!ModelID) End Sub
I am trying to populate the field [frmQuotes]!ModelRetailPrice with the ModelRetailPrice from the tblModel based upon the ModelID input on the [frmQuotes]!ModelID.
Thank you.
Alberto
|
|
On Tue, 2 Dec 2008 19:23:32 -0800 (PST), acitarella[ at ]gmail.com wrote:
[Quoted Text] >I have run the following "event procedure" from a combo box and am >getting a "data type mismatch error: 3464" > >Private Sub ModelRetailPrice_AfterUpdate() >Forms![frmQuotes]!ModelRetailPrice = DLookup("ModelretailPrice", >"tblModel", "ModelID = " & Forms![frmQuotes]!ModelID) >End Sub > >I am trying to populate the field [frmQuotes]!ModelRetailPrice with >the ModelRetailPrice from the tblModel based upon the ModelID input on >the [frmQuotes]!ModelID. > >Thank you. > >Alberto
Is the datatype of ModelID perhaps Text? If so, you need the syntactically required quotemarks:
DLookup("ModelretailPrice","tblModel", "ModelID = '" & Forms![frmQuotes]!ModelID & "'")
For clarity (don't do it this way) that's
DLookup("ModelretailPrice","tblModel", "ModelID = ' " & Forms![frmQuotes]!ModelID & " ' ")
--
John W. Vinson [MVP]
|
|
On Dec 2, 10:57 pm, John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> wrote:
[Quoted Text] > On Tue, 2 Dec 2008 19:23:32 -0800 (PST), acitare...[ at ]gmail.com wrote: > >I have run the following "event procedure" from a combo box and am > >getting a "data type mismatch error: 3464" > > >Private Sub ModelRetailPrice_AfterUpdate() > >Forms![frmQuotes]!ModelRetailPrice = DLookup("ModelretailPrice", > >"tblModel", "ModelID = " & Forms![frmQuotes]!ModelID) > >End Sub > > >I am trying to populate the field [frmQuotes]!ModelRetailPrice with > >the ModelRetailPrice from the tblModel based upon the ModelID input on > >the [frmQuotes]!ModelID. > > >Thank you. > > >Alberto > > Is the datatype of ModelID perhaps Text? If so, you need the syntactically > required quotemarks: > > DLookup("ModelretailPrice","tblModel", "ModelID = '" & > Forms![frmQuotes]!ModelID & "'") > > For clarity (don't do it this way) that's > > DLookup("ModelretailPrice","tblModel", "ModelID = ' " & > Forms![frmQuotes]!ModelID & " ' ") > > -- > > John W. Vinson [MVP]- Hide quoted text - > > - Show quoted text -
Thanks John. When I do it this way, nothing happens when I enter in the Model ID in the form (i.e. the ModelRetailPrice does not populate).
|
|
"acitarella" <acitarella[ at ]gmail.com> wrote in message news:9c44bfeb-9dc9-45fe-8cfd-dcf6293ec28d[ at ]f20g2000yqg.googlegroups.com... On Dec 2, 10:57 pm, John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> wrote:
[Quoted Text] > On Tue, 2 Dec 2008 19:23:32 -0800 (PST), acitare...[ at ]gmail.com wrote: > >I have run the following "event procedure" from a combo box and am > >getting a "data type mismatch error: 3464" > > >Private Sub ModelRetailPrice_AfterUpdate() > >Forms![frmQuotes]!ModelRetailPrice = DLookup("ModelretailPrice", > >"tblModel", "ModelID = " & Forms![frmQuotes]!ModelID) > >End Sub > > >I am trying to populate the field [frmQuotes]!ModelRetailPrice with > >the ModelRetailPrice from the tblModel based upon the ModelID input on > >the [frmQuotes]!ModelID. > > >Thank you. > > >Alberto > > Is the datatype of ModelID perhaps Text? If so, you need the syntactically > required quotemarks: > > DLookup("ModelretailPrice","tblModel", "ModelID = '" & > Forms![frmQuotes]!ModelID & "'") > > For clarity (don't do it this way) that's > > DLookup("ModelretailPrice","tblModel", "ModelID = ' " & > Forms![frmQuotes]!ModelID & " ' ") > > -- > > John W. Vinson [MVP]- Hide quoted text - > > - Show quoted text -
Thanks John. When I do it this way, nothing happens when I enter in the Model ID in the form (i.e. the ModelRetailPrice does not populate).
acitarella, Try... Refresh DLookup("ModelretailPrice","tblModel", "ModelID = Forms![frmQuotes]![ModelID]") -- hth Al Campagna Microsoft Access MVP http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your life."
|
|
acitarella wrote:
[Quoted Text] > On Dec 2, 10:57 pm, John W. Vinson > <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> wrote: >> On Tue, 2 Dec 2008 19:23:32 -0800 (PST), acitare...[ at ]gmail.com wrote: >>> I have run the following "event procedure" from a combo box and am >>> getting a "data type mismatch error: 3464" >> >>> Private Sub ModelRetailPrice_AfterUpdate() >>> Forms![frmQuotes]!ModelRetailPrice = DLookup("ModelretailPrice", >>> "tblModel", "ModelID = " & Forms![frmQuotes]!ModelID) >>> End Sub >> >>> I am trying to populate the field [frmQuotes]!ModelRetailPrice with >>> the ModelRetailPrice from the tblModel based upon the ModelID input >>> on the [frmQuotes]!ModelID. >> >>> Thank you. >> >>> Alberto >> >> Is the datatype of ModelID perhaps Text? If so, you need the >> syntactically required quotemarks: >> >> DLookup("ModelretailPrice","tblModel", "ModelID = '" & >> Forms![frmQuotes]!ModelID & "'") >> >> For clarity (don't do it this way) that's >> >> DLookup("ModelretailPrice","tblModel", "ModelID = ' " & >> Forms![frmQuotes]!ModelID & " ' ") >> >> -- >> >> John W. Vinson [MVP]- Hide quoted text - >> >> - Show quoted text - > > Thanks John. When I do it this way, nothing happens when I enter in > the Model ID in the form (i.e. the ModelRetailPrice does not > populate).
You probably want it in the after update event for the Model ID. If you relate the tables involved there is no need for a DLookup. It would also make easier showing the description.
|
|
|