I am having trouble getting a calulated query field to remain as a NUMBER. It seems to automatically become a text field which then messes up the calculated field afterwards.
I have a qryDetail. Amongst the fields are 4 kinds of ID's per record that are number long interger fields.
I made 2 calculated fields in the qry. The first calculated field is named EmailIDused and contains the many IIF statements to determine which of the 4 ID's to use. For some reason, this calculated field is left justified appearing as Text. I was hoping it would be a number.
The second calculated field EmailUsed assumes it is looking at EmilIDused as a number.
So it bombs out when it finds EmailIDused is text.
The first 4 fields are number fields in a table.
ID
SendGroupTicketToCode
SendSplinterTicketToCode
SendLineRunTicketToCode
The next 2 calculated fields are in the qry.
EmailIDused: Nz(IIf(IsNull(Nz([SendGroupTicketToCode])) Or IsNull(Nz([SendSplinterTicketToCode])) Or IsNull(Nz([SendLineRunTicketToCode])),[tblDetail].[ID],IIf(Nz([SendGroupTicketToCode]) Is Not Null,Nz([SendGroupTicketToCode]),IIf(Nz([SendSplinterTicketToCode]) Is Not Null,Nz([SendSplinterTicketToCode]),IIf(Nz([SendLineRunTicketToCode]) Is Not Null,Nz([SendLineRunTicketToCode]))))))
The above gets me the correct answer. However, it is left justified as text.
I wanted it to remain as a number field.
My plan was to use EmailIDused to do a lookup into the customer table for the proper email
address to use.
EmailUsed: DLookUp("","tblCustInfo","[tblCustInfo]![ID]=Nz([EmailIDused])")
When i run the Qry, I get the message
"the expression you entered as a query parameter produced this error, microsoft cannot find the name EmailIDUsed".
I tried making a parameter long interger for the calculated field EmailIDused but it did not help. Cimoli
Thanks for the help.
I have a qryDetail. Amongst the fields are 4 kinds of ID's per record that are number long interger fields.
I made 2 calculated fields in the qry. The first calculated field is named EmailIDused and contains the many IIF statements to determine which of the 4 ID's to use. For some reason, this calculated field is left justified appearing as Text. I was hoping it would be a number.
The second calculated field EmailUsed assumes it is looking at EmilIDused as a number.
So it bombs out when it finds EmailIDused is text.
The first 4 fields are number fields in a table.
ID
SendGroupTicketToCode
SendSplinterTicketToCode
SendLineRunTicketToCode
The next 2 calculated fields are in the qry.
EmailIDused: Nz(IIf(IsNull(Nz([SendGroupTicketToCode])) Or IsNull(Nz([SendSplinterTicketToCode])) Or IsNull(Nz([SendLineRunTicketToCode])),[tblDetail].[ID],IIf(Nz([SendGroupTicketToCode]) Is Not Null,Nz([SendGroupTicketToCode]),IIf(Nz([SendSplinterTicketToCode]) Is Not Null,Nz([SendSplinterTicketToCode]),IIf(Nz([SendLineRunTicketToCode]) Is Not Null,Nz([SendLineRunTicketToCode]))))))
The above gets me the correct answer. However, it is left justified as text.
I wanted it to remain as a number field.
My plan was to use EmailIDused to do a lookup into the customer table for the proper email
address to use.
EmailUsed: DLookUp("","tblCustInfo","[tblCustInfo]![ID]=Nz([EmailIDused])")
When i run the Qry, I get the message
"the expression you entered as a query parameter produced this error, microsoft cannot find the name EmailIDUsed".
I tried making a parameter long interger for the calculated field EmailIDused but it did not help. Cimoli
Thanks for the help.