PC Review


Reply
Thread Tools Rate Thread

Dlookup Question

 
 
buzzmcduffie
Guest
Posts: n/a
 
      11th May 2010
I have a form that needs to look up a "goal" by matching several fields in a
> table. I can't figure out how to do dlookup with multiple criteria
>
> Form = frmManualTaskDataEntry
> [employee]
> [cbxMailCodeTask]
> [cbxState]
> [cbxDisabilityIndicator]
> [cbxVolumeCode]
>
> Table = tblMailCodeTasks
> MailCodeTask
> State
> DisabilityIndicator
> VolumeCode
> Goal
> Active


Here's what I have that doesn't work:

Private Sub cbxCompany_AfterUpdate()
Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", tblMailCodeTasks.MailCode
= [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask]) And
((tblMailCodeTasks.DisabilityIndicator) =
[Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator]) And
((tblMailCodeTasks.State) = [Forms]![frmManualTasksDataEntry]![cbxState]) And
((tblMailCodeTasks.Active) = "yes")
End Sub

Any help is appreciated!
 
Reply With Quote
 
 
 
 
RonaldoOneNil
Guest
Posts: n/a
 
      11th May 2010
The following assumes that all your fields in the Lookup are Text values and
so are surrounded by single quotes.

Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", "MailCode = '" &
[Forms]![frmManualTasksDataEntry]![cbxMailCodeTask] & "' And
DisabilityIndicator = '" &
[Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator] & "' And State =
'" & [Forms]![frmManualTasksDataEntry]![cbxState] & "' And Active = 'yes')

"buzzmcduffie" wrote:

> I have a form that needs to look up a "goal" by matching several fields in a
> > table. I can't figure out how to do dlookup with multiple criteria
> >
> > Form = frmManualTaskDataEntry
> > [employee]
> > [cbxMailCodeTask]
> > [cbxState]
> > [cbxDisabilityIndicator]
> > [cbxVolumeCode]
> >
> > Table = tblMailCodeTasks
> > MailCodeTask
> > State
> > DisabilityIndicator
> > VolumeCode
> > Goal
> > Active

>
> Here's what I have that doesn't work:
>
> Private Sub cbxCompany_AfterUpdate()
> Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", tblMailCodeTasks.MailCode
> = [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask]) And
> ((tblMailCodeTasks.DisabilityIndicator) =
> [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator]) And
> ((tblMailCodeTasks.State) = [Forms]![frmManualTasksDataEntry]![cbxState]) And
> ((tblMailCodeTasks.Active) = "yes")
> End Sub
>
> Any help is appreciated!

 
Reply With Quote
 
buzzmcduffie
Guest
Posts: n/a
 
      11th May 2010
I'm still getting a syntax error when I copy and paste your code. I must not
understand.

"RonaldoOneNil" wrote:

> The following assumes that all your fields in the Lookup are Text values and
> so are surrounded by single quotes.
>
> Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", "MailCode = '" &
> [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask] & "' And
> DisabilityIndicator = '" &
> [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator] & "' And State =
> '" & [Forms]![frmManualTasksDataEntry]![cbxState] & "' And Active = 'yes')
>
> "buzzmcduffie" wrote:
>
> > I have a form that needs to look up a "goal" by matching several fields in a
> > > table. I can't figure out how to do dlookup with multiple criteria
> > >
> > > Form = frmManualTaskDataEntry
> > > [employee]
> > > [cbxMailCodeTask]
> > > [cbxState]
> > > [cbxDisabilityIndicator]
> > > [cbxVolumeCode]
> > >
> > > Table = tblMailCodeTasks
> > > MailCodeTask
> > > State
> > > DisabilityIndicator
> > > VolumeCode
> > > Goal
> > > Active

> >
> > Here's what I have that doesn't work:
> >
> > Private Sub cbxCompany_AfterUpdate()
> > Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", tblMailCodeTasks.MailCode
> > = [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask]) And
> > ((tblMailCodeTasks.DisabilityIndicator) =
> > [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator]) And
> > ((tblMailCodeTasks.State) = [Forms]![frmManualTasksDataEntry]![cbxState]) And
> > ((tblMailCodeTasks.Active) = "yes")
> > End Sub
> >
> > Any help is appreciated!

 
Reply With Quote
 
RonaldoOneNil
Guest
Posts: n/a
 
      11th May 2010
Sorry missed the closing double quotes off the end

...... And Active = 'yes'")

"buzzmcduffie" wrote:

> I'm still getting a syntax error when I copy and paste your code. I must not
> understand.
>
> "RonaldoOneNil" wrote:
>
> > The following assumes that all your fields in the Lookup are Text values and
> > so are surrounded by single quotes.
> >
> > Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", "MailCode = '" &
> > [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask] & "' And
> > DisabilityIndicator = '" &
> > [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator] & "' And State =
> > '" & [Forms]![frmManualTasksDataEntry]![cbxState] & "' And Active = 'yes')
> >
> > "buzzmcduffie" wrote:
> >
> > > I have a form that needs to look up a "goal" by matching several fields in a
> > > > table. I can't figure out how to do dlookup with multiple criteria
> > > >
> > > > Form = frmManualTaskDataEntry
> > > > [employee]
> > > > [cbxMailCodeTask]
> > > > [cbxState]
> > > > [cbxDisabilityIndicator]
> > > > [cbxVolumeCode]
> > > >
> > > > Table = tblMailCodeTasks
> > > > MailCodeTask
> > > > State
> > > > DisabilityIndicator
> > > > VolumeCode
> > > > Goal
> > > > Active
> > >
> > > Here's what I have that doesn't work:
> > >
> > > Private Sub cbxCompany_AfterUpdate()
> > > Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", tblMailCodeTasks.MailCode
> > > = [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask]) And
> > > ((tblMailCodeTasks.DisabilityIndicator) =
> > > [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator]) And
> > > ((tblMailCodeTasks.State) = [Forms]![frmManualTasksDataEntry]![cbxState]) And
> > > ((tblMailCodeTasks.Active) = "yes")
> > > End Sub
> > >
> > > Any help is appreciated!

 
Reply With Quote
 
RonaldoOneNil
Guest
Posts: n/a
 
      12th May 2010
Also it needs to be all on one line unless you use the underscore
continuation character.

"buzzmcduffie" wrote:

> I'm still getting a syntax error when I copy and paste your code. I must not
> understand.
>
> "RonaldoOneNil" wrote:
>
> > The following assumes that all your fields in the Lookup are Text values and
> > so are surrounded by single quotes.
> >
> > Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", "MailCode = '" &
> > [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask] & "' And
> > DisabilityIndicator = '" &
> > [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator] & "' And State =
> > '" & [Forms]![frmManualTasksDataEntry]![cbxState] & "' And Active = 'yes')
> >
> > "buzzmcduffie" wrote:
> >
> > > I have a form that needs to look up a "goal" by matching several fields in a
> > > > table. I can't figure out how to do dlookup with multiple criteria
> > > >
> > > > Form = frmManualTaskDataEntry
> > > > [employee]
> > > > [cbxMailCodeTask]
> > > > [cbxState]
> > > > [cbxDisabilityIndicator]
> > > > [cbxVolumeCode]
> > > >
> > > > Table = tblMailCodeTasks
> > > > MailCodeTask
> > > > State
> > > > DisabilityIndicator
> > > > VolumeCode
> > > > Goal
> > > > Active
> > >
> > > Here's what I have that doesn't work:
> > >
> > > Private Sub cbxCompany_AfterUpdate()
> > > Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", tblMailCodeTasks.MailCode
> > > = [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask]) And
> > > ((tblMailCodeTasks.DisabilityIndicator) =
> > > [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator]) And
> > > ((tblMailCodeTasks.State) = [Forms]![frmManualTasksDataEntry]![cbxState]) And
> > > ((tblMailCodeTasks.Active) = "yes")
> > > End Sub
> > >
> > > Any help is appreciated!

 
Reply With Quote
 
buzzmcduffie
Guest
Posts: n/a
 
      12th May 2010
worked like a charm! thank you!

"RonaldoOneNil" wrote:

> Also it needs to be all on one line unless you use the underscore
> continuation character.
>
> "buzzmcduffie" wrote:
>
> > I'm still getting a syntax error when I copy and paste your code. I must not
> > understand.
> >
> > "RonaldoOneNil" wrote:
> >
> > > The following assumes that all your fields in the Lookup are Text values and
> > > so are surrounded by single quotes.
> > >
> > > Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", "MailCode = '" &
> > > [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask] & "' And
> > > DisabilityIndicator = '" &
> > > [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator] & "' And State =
> > > '" & [Forms]![frmManualTasksDataEntry]![cbxState] & "' And Active = 'yes')
> > >
> > > "buzzmcduffie" wrote:
> > >
> > > > I have a form that needs to look up a "goal" by matching several fields in a
> > > > > table. I can't figure out how to do dlookup with multiple criteria
> > > > >
> > > > > Form = frmManualTaskDataEntry
> > > > > [employee]
> > > > > [cbxMailCodeTask]
> > > > > [cbxState]
> > > > > [cbxDisabilityIndicator]
> > > > > [cbxVolumeCode]
> > > > >
> > > > > Table = tblMailCodeTasks
> > > > > MailCodeTask
> > > > > State
> > > > > DisabilityIndicator
> > > > > VolumeCode
> > > > > Goal
> > > > > Active
> > > >
> > > > Here's what I have that doesn't work:
> > > >
> > > > Private Sub cbxCompany_AfterUpdate()
> > > > Me![Goal] = DLookup("[Goal]", "tblMailCodeTasks", tblMailCodeTasks.MailCode
> > > > = [Forms]![frmManualTasksDataEntry]![cbxMailCodeTask]) And
> > > > ((tblMailCodeTasks.DisabilityIndicator) =
> > > > [Forms]![frmManualTasksDataEntry]![cbxDisabilityIndicator]) And
> > > > ((tblMailCodeTasks.State) = [Forms]![frmManualTasksDataEntry]![cbxState]) And
> > > > ((tblMailCodeTasks.Active) = "yes")
> > > > End Sub
> > > >
> > > > Any help is appreciated!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DLOOKUP question =?Utf-8?B?Qm9ubmll?= Microsoft Access 4 23rd Feb 2007 04:11 AM
DLookup Question rollover99 via AccessMonster.com Microsoft Access VBA Modules 3 6th Jul 2006 08:59 PM
dlookup question =?Utf-8?B?bHVsYQ==?= Microsoft Access 1 16th Nov 2005 10:11 PM
Dlookup Question =?Utf-8?B?bmR1bndvb2RpZQ==?= Microsoft Access Form Coding 2 21st Apr 2005 07:17 PM
Another Dlookup Question Brig Microsoft Access 3 17th Dec 2004 02:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 PM.