From: Douglas J. Steele on 25 May 2010 11:43 Since BatchNum is text, the value being passed must be in quotes: Me.txtBinsScanned = DCount("[BatchNum]", "[tblPreSortBatchBackup]", "[BatchNum]='" & [Forms]![frmTraceBox]![txtBatch] & "'") Exagerated for clarity, that's "[BatchNum]= ' " & [Forms]![frmTraceBox]![txtBatch] & " ' ") -- Doug Steele, Microsoft Access MVP http://www.AccessMVP.com/DJSteele (no e-mails, please!) "FatMan" <FatMan(a)discussions.microsoft.com> wrote in message news:3AF541DE-E5CD-4A03-85AF-E4A007C40758(a)microsoft.com... > Hi all: > The code listed below is giving me a "Data Type mismatch in criteria > expression" error. > > Code: > Me.txtBinsScanned = DCount("[BatchNum]", "[tblPreSortBatchBackup]", > "[BatchNum]=" & [Forms]![frmTraceBox]![txtBatch]) > > > Where: > BatchNum data type is text > > TxtBatch is a text box on my form that is getting its value through a > dlookup function and the results being returned are from a text field from > a > different table. It works and the code for it is: > > Me.txtBatch = DLookup("[InFriutTransLog]", "[tblIntake]", "[IntakeID]=" & > [Forms]![frmTraceBox]![txtIntakeID]) > > All help is greatly appreciated. > > Thanks, > FatMan >
From: FatMan on 25 May 2010 15:19 Doug: You da man! Thanks, FatMan "Douglas J. Steele" wrote: > Since BatchNum is text, the value being passed must be in quotes: > > Me.txtBinsScanned = DCount("[BatchNum]", "[tblPreSortBatchBackup]", > "[BatchNum]='" & [Forms]![frmTraceBox]![txtBatch] & "'") > > Exagerated for clarity, that's > > "[BatchNum]= ' " & [Forms]![frmTraceBox]![txtBatch] & " ' ") > > -- > Doug Steele, Microsoft Access MVP > http://www.AccessMVP.com/DJSteele > (no e-mails, please!) > > "FatMan" <FatMan(a)discussions.microsoft.com> wrote in message > news:3AF541DE-E5CD-4A03-85AF-E4A007C40758(a)microsoft.com... > > Hi all: > > The code listed below is giving me a "Data Type mismatch in criteria > > expression" error. > > > > Code: > > Me.txtBinsScanned = DCount("[BatchNum]", "[tblPreSortBatchBackup]", > > "[BatchNum]=" & [Forms]![frmTraceBox]![txtBatch]) > > > > > > Where: > > BatchNum data type is text > > > > TxtBatch is a text box on my form that is getting its value through a > > dlookup function and the results being returned are from a text field from > > a > > different table. It works and the code for it is: > > > > Me.txtBatch = DLookup("[InFriutTransLog]", "[tblIntake]", "[IntakeID]=" & > > [Forms]![frmTraceBox]![txtIntakeID]) > > > > All help is greatly appreciated. > > > > Thanks, > > FatMan > > > > > . >
|
Pages: 1 Prev: return Subform Name on Tab control Next: Form_Delete event can't fire requery in other form |