A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dlookup Question



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2010, 12:14 PM posted to microsoft.public.access.forms
buzzmcduffie
external usenet poster
 
Posts: 35
Default Dlookup Question

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!
  #2  
Old May 11th, 2010, 12:29 PM posted to microsoft.public.access.forms
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Dlookup Question

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!

  #3  
Old May 11th, 2010, 01:15 PM posted to microsoft.public.access.forms
buzzmcduffie
external usenet poster
 
Posts: 35
Default Dlookup Question

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!

  #4  
Old May 11th, 2010, 03:10 PM posted to microsoft.public.access.forms
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Dlookup Question

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!

  #5  
Old May 12th, 2010, 09:00 AM posted to microsoft.public.access.forms
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Dlookup Question

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!

  #6  
Old May 12th, 2010, 11:31 AM posted to microsoft.public.access.forms
buzzmcduffie
external usenet poster
 
Posts: 35
Default Dlookup Question

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!

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.