Troy Troy - 1 month ago 7 Question I cannot return datarows from access when searching for boolean true value

I've google searched and searched here, but I'm not sure of the terminology to use, so I'm not having luck with search results.

I'm writing a front end to an access database. It's logging product change requests. The process flow is something like this - any user submits a request, and the status of the request is set to "request" an administrator then evaluates the requests and determines if more information is needed to proceed, if we are going to proceed without additional info, or if the request is denied. If more information is needed - he/she may check a box for laborCost as an example. When they 'submit' updates (saves changes back to database) my code then should email those tied to labor to inform them to supply a value for further review. It then sets the status to pending.

The way I am attempting this - is with a users table (tblusers) It has access yes/no boxes for EngCost, MatlCost, LaborCost, and ToolCost.

If the labor box is checked on the PCR form - I am then attempting to look at the users table via a dataset - look at the column for laborcost and return all of the "true" values - so that I can 'return' a string to populate an outlook "Send to:" email.

here's my code so far

Public Function sendto(field As String)

Dim foundrows() As Data.DataRow
'Dim e() As String
' Dim es As String
'Dim fltr As Boolean = True

foundrows = DsPcrMaintenance.Tables("tblUsers").Select(field & "<> 0")

For i As Integer = 0 To foundrows.Count - 1

e(i) = DsPcrMaintenance.Tables("tblusers").Rows(i)("email")


for all of the rows found, I'm wanting to grab the email address from that row, then combine that array to a string of addresses for my sendto.

I'm passing the column name into the function using 'field' and that works -
Field in this case is "laborCost" and I'm adding <>0 so it's not false.
but I'm getting 'nothing' for foundrows. I've tried field & "<> '0'", I've tried true and false, 0 and -1, and I can't get a result.

essentially, I want to lookup the true value of the grouping, then for each row returned, build my "to:" email string.; etc.

Most of the categories have more than one send to. Sorry for the long post -trying to be thorough.


Inside your loop you shoud use the foundRows not on the rows of the original table

Redim e(foundRows.Length)
For i As Integer = 0 To foundrows.Count - 1

    If Not IsDBNull(foundRows(i)("email")) Then
        e(i) = foundRows(i)("email").ToString()
    End If