need help writing a DLookup statement

M

Mark Kubicki

on a form <FixtureCataloges>,
i have 2 fields that uniquely identify the record: [Manufacturer] and
[CatalogNumber];

also on the form is a subform with 1 field: [Options], whose data source is
a table, FixtureCatalogsLuminiareTypes,
the table has 3 fields [Manufacturer] [CatalogNum] and [Option]
(-spelled differently... too many people woking on the same...);
and is related to the data source used for the main form with fields:
[Manufacturer] and [CatalogNum]


when a user goes to the subform, i'd like to check is a value 'accent light'
is present in the subform's data source


i've written the following code, but it's not working (i get error '2428'
invalid domain aggregate...)
any suggestions would be greatly appreciated

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", FixtureCatalogsLuminiareTypes, _
"[Option] = 'accent light' and [Manufacturer] = " &
Forms![FixtureCataloges].Manufacturer _
& " and [CatalogNum] = " & Forms![FixtureCataloges].CatalogNumber)
If IsNull(varX) Then
...
Else
...
End If
End Sub


thanks in advance,
Mark
 
R

RonaldoOneNil

Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....
 
M

Mark Kubicki

thanks... i added them, along with a couple of additional quotes since all
of the fields are string, and am now getting this error: 3075 syntax
error...

the revised code is:
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber)
& "'"


RonaldoOneNil said:
Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....


Mark Kubicki said:
on a form <FixtureCataloges>,
i have 2 fields that uniquely identify the record: [Manufacturer] and
[CatalogNumber];

also on the form is a subform with 1 field: [Options], whose data source
is
a table, FixtureCatalogsLuminiareTypes,
the table has 3 fields [Manufacturer] [CatalogNum] and [Option]
(-spelled differently... too many people woking on the same...);
and is related to the data source used for the main form with fields:
[Manufacturer] and [CatalogNum]


when a user goes to the subform, i'd like to check is a value 'accent
light'
is present in the subform's data source


i've written the following code, but it's not working (i get error '2428'
invalid domain aggregate...)
any suggestions would be greatly appreciated

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", FixtureCatalogsLuminiareTypes, _
"[Option] = 'accent light' and [Manufacturer] = " &
Forms![FixtureCataloges].Manufacturer _
& " and [CatalogNum] = " &
Forms![FixtureCataloges].CatalogNumber)
If IsNull(varX) Then
...
Else
...
End If
End Sub


thanks in advance,
Mark
 
R

RonaldoOneNil

The quotes at the end needs to be inside the last bracket
..... and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber & "'")



Mark Kubicki said:
thanks... i added them, along with a couple of additional quotes since all
of the fields are string, and am now getting this error: 3075 syntax
error...

the revised code is:
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber)
& "'"


RonaldoOneNil said:
Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....


Mark Kubicki said:
on a form <FixtureCataloges>,
i have 2 fields that uniquely identify the record: [Manufacturer] and
[CatalogNumber];

also on the form is a subform with 1 field: [Options], whose data source
is
a table, FixtureCatalogsLuminiareTypes,
the table has 3 fields [Manufacturer] [CatalogNum] and [Option]
(-spelled differently... too many people woking on the same...);
and is related to the data source used for the main form with fields:
[Manufacturer] and [CatalogNum]


when a user goes to the subform, i'd like to check is a value 'accent
light'
is present in the subform's data source


i've written the following code, but it's not working (i get error '2428'
invalid domain aggregate...)
any suggestions would be greatly appreciated

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", FixtureCatalogsLuminiareTypes, _
"[Option] = 'accent light' and [Manufacturer] = " &
Forms![FixtureCataloges].Manufacturer _
& " and [CatalogNum] = " &
Forms![FixtureCataloges].CatalogNumber)
If IsNull(varX) Then
...
Else
...
End If
End Sub


thanks in advance,
Mark
 
M

Mark Kubicki

thanks for your perserverence... (i'm getting all twisted up over a small
and what should be very simple statement); now i'm getting this error:
2471, expression produced this error: '[CatalogNum]' - HUH !?

-m


RonaldoOneNil said:
The quotes at the end needs to be inside the last bracket
.... and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber & "'")



Mark Kubicki said:
thanks... i added them, along with a couple of additional quotes since
all
of the fields are string, and am now getting this error: 3075 syntax
error...

the revised code is:
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" &
Forms![FixtureCataloges].CatalogNumber)
& "'"


message
Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....


:

on a form <FixtureCataloges>,
i have 2 fields that uniquely identify the record: [Manufacturer]
and
[CatalogNumber];

also on the form is a subform with 1 field: [Options], whose data
source
is
a table, FixtureCatalogsLuminiareTypes,
the table has 3 fields [Manufacturer] [CatalogNum] and [Option]
(-spelled differently... too many people woking on the same...);
and is related to the data source used for the main form with
fields:
[Manufacturer] and [CatalogNum]


when a user goes to the subform, i'd like to check is a value 'accent
light'
is present in the subform's data source


i've written the following code, but it's not working (i get error
'2428'
invalid domain aggregate...)
any suggestions would be greatly appreciated

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", FixtureCatalogsLuminiareTypes, _
"[Option] = 'accent light' and [Manufacturer] = " &
Forms![FixtureCataloges].Manufacturer _
& " and [CatalogNum] = " &
Forms![FixtureCataloges].CatalogNumber)
If IsNull(varX) Then
...
Else
...
End If
End Sub


thanks in advance,
Mark
 
R

RonaldoOneNil

I can't see anything wrong with the statement.
Post your current DLookup statement as it stands

Mark Kubicki said:
thanks for your perserverence... (i'm getting all twisted up over a small
and what should be very simple statement); now i'm getting this error:
2471, expression produced this error: '[CatalogNum]' - HUH !?

-m


RonaldoOneNil said:
The quotes at the end needs to be inside the last bracket
.... and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber & "'")



Mark Kubicki said:
thanks... i added them, along with a couple of additional quotes since
all
of the fields are string, and am now getting this error: 3075 syntax
error...

the revised code is:
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" &
Forms![FixtureCataloges].CatalogNumber)
& "'"


message
Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....


:

on a form <FixtureCataloges>,
i have 2 fields that uniquely identify the record: [Manufacturer]
and
[CatalogNumber];

also on the form is a subform with 1 field: [Options], whose data
source
is
a table, FixtureCatalogsLuminiareTypes,
the table has 3 fields [Manufacturer] [CatalogNum] and [Option]
(-spelled differently... too many people woking on the same...);
and is related to the data source used for the main form with
fields:
[Manufacturer] and [CatalogNum]


when a user goes to the subform, i'd like to check is a value 'accent
light'
is present in the subform's data source


i've written the following code, but it's not working (i get error
'2428'
invalid domain aggregate...)
any suggestions would be greatly appreciated

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", FixtureCatalogsLuminiareTypes, _
"[Option] = 'accent light' and [Manufacturer] = " &
Forms![FixtureCataloges].Manufacturer _
& " and [CatalogNum] = " &
Forms![FixtureCataloges].CatalogNumber)
If IsNull(varX) Then
...
Else
...
End If
End Sub


thanks in advance,
Mark
 
M

Mark Kubicki

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber
& "'")
If IsNull(varX) Then
...


----------------------------------------------
RonaldoOneNil said:
I can't see anything wrong with the statement.
Post your current DLookup statement as it stands

Mark Kubicki said:
thanks for your perserverence... (i'm getting all twisted up over a
small
and what should be very simple statement); now i'm getting this error:
2471, expression produced this error: '[CatalogNum]' - HUH !?

-m


message
The quotes at the end needs to be inside the last bracket
.... and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber &
"'")



:

thanks... i added them, along with a couple of additional quotes since
all
of the fields are string, and am now getting this error: 3075 syntax
error...

the revised code is:
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" &
Forms![FixtureCataloges].CatalogNumber)
& "'"


message
Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....


:

on a form <FixtureCataloges>,
i have 2 fields that uniquely identify the record:
[Manufacturer]
and
[CatalogNumber];

also on the form is a subform with 1 field: [Options], whose data
source
is
a table, FixtureCatalogsLuminiareTypes,
the table has 3 fields [Manufacturer] [CatalogNum] and
[Option]
(-spelled differently... too many people woking on the same...);
and is related to the data source used for the main form with
fields:
[Manufacturer] and [CatalogNum]


when a user goes to the subform, i'd like to check is a value
'accent
light'
is present in the subform's data source


i've written the following code, but it's not working (i get error
'2428'
invalid domain aggregate...)
any suggestions would be greatly appreciated

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", FixtureCatalogsLuminiareTypes, _
"[Option] = 'accent light' and [Manufacturer] = " &
Forms![FixtureCataloges].Manufacturer _
& " and [CatalogNum] = " &
Forms![FixtureCataloges].CatalogNumber)
If IsNull(varX) Then
...
Else
...
End If
End Sub


thanks in advance,
Mark
 
M

Mark Kubicki

GOT IT THANKS


Mark Kubicki said:
Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber
& "'")
If IsNull(varX) Then
...


----------------------------------------------
RonaldoOneNil said:
I can't see anything wrong with the statement.
Post your current DLookup statement as it stands

Mark Kubicki said:
thanks for your perserverence... (i'm getting all twisted up over a
small
and what should be very simple statement); now i'm getting this error:
2471, expression produced this error: '[CatalogNum]' - HUH !?

-m


message
The quotes at the end needs to be inside the last bracket
.... and [CatalogNum] = '" & Forms![FixtureCataloges].CatalogNumber &
"'")



:

thanks... i added them, along with a couple of additional quotes
since
all
of the fields are string, and am now getting this error: 3075 syntax
error...

the revised code is:
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", _
"[Option] = 'accent light' and [Manufacturer] = '" &
Forms![FixtureCataloges].Manufacturer _
& "' and [CatalogNum] = '" &
Forms![FixtureCataloges].CatalogNumber)
& "'"


message
Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....


:

on a form <FixtureCataloges>,
i have 2 fields that uniquely identify the record:
[Manufacturer]
and
[CatalogNumber];

also on the form is a subform with 1 field: [Options], whose data
source
is
a table, FixtureCatalogsLuminiareTypes,
the table has 3 fields [Manufacturer] [CatalogNum] and
[Option]
(-spelled differently... too many people woking on the same...);
and is related to the data source used for the main form with
fields:
[Manufacturer] and [CatalogNum]


when a user goes to the subform, i'd like to check is a value
'accent
light'
is present in the subform's data source


i've written the following code, but it's not working (i get error
'2428'
invalid domain aggregate...)
any suggestions would be greatly appreciated

Private Sub Options_GotFocus()
varX = Null
Me.Options.Requery
varX = DLookup("[Option]", FixtureCatalogsLuminiareTypes, _
"[Option] = 'accent light' and [Manufacturer] = " &
Forms![FixtureCataloges].Manufacturer _
& " and [CatalogNum] = " &
Forms![FixtureCataloges].CatalogNumber)
If IsNull(varX) Then
...
Else
...
End If
End Sub


thanks in advance,
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top