need help writing a DLookup statement

  • Thread starter Thread starter Mark Kubicki
  • Start date Start date
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
 
Put quotes round your domain as well
varX = DLookup("[Option]", "FixtureCatalogsLuminiareTypes", .....
 
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
 
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
 
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
 
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
 
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
 
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
 
Back
Top