Question: I have a table where the user can select a colour scheme for their database

```
ID | Colour     | SelectedScheme
---|------------|--------------
1  | 136,207,39 | Yes

```

Then on my form I have the following on the current events tab

```
Dim RGBcolor As Long
RBGcolor = DLookup("Colour", "SelectedScheme")
Me.boxheader.BackColor = RGB(RGBcolor)

```

but I'm getting the Argument not optional error. any idea?

Answer: 
Arguments of RGB function are numeric, not string, and there should be 3 of them:

```
RGB(136,207,39)

```

You are trying to pass one string argument.
You can use `Split` function for extracting color values from string:

```
Me.boxheader.BackColor = RGB(Split(RGBcolor,",")(0),Split(RGBcolor,",")(1),Split(RGBcolor,",")(2))

```
The Dlookup function accepts these arguments:

* FieldName: a field, calculation, control on a form, or function that you wish to return;
* TableName: the set of records. This can be a table or a query name;
* Criteria (Optional): It is the WHERE clause to apply to the TableName.

And the RGB functions accepts these three:

* red: the red component of the color;
* green: the green component of the color;
* blue: the blue component of the color.

I would suggest you to use three different columns for the component color in your table:

```
ID | ColourR | ColourG | ColourB | SelectedScheme
---|---------|---------|---------|---------------
1  | 136     |207      | 39      | Yes

```

Your event can be written as this:

```
Me.boxheader.BackColor = RGB(
  DLookup("ColourR", "SchemaTableName", "SelectedScheme=TRUE"),
  DLookup("ColourG", "SchemaTableName", "SelectedScheme=TRUE"),
  DLookup("ColourB", "SchemaTableName", "SelectedScheme=TRUE")
)

```

this will select the color from the table SchemaTableName where the field SelectedScheme is set to true.