Ok, I'm very, very, very new to using FLEX in Macola (ES v 9.5.500) and have very little VB experience...
I am doing some testing in OE0101 because I want to add flex to prevent users from entering an order if a customer is over their credit limit (not just put the order on hold like Macola only allows). However, I've run into a stumbling block early on and I'm sure it's something stupid:
I am just trying to test passing the customer number to a query and returning a value from cicmpy just to see if it works. Here is my code:
Private Sub Customer_LoseFocus(AllowLoseFocus As Boolean)
On Error GoTo ERR_HANDLER
Dim myAdo As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Set myAdo = Me.ConnInfpenADOConn
Set myRecordset = myAdo.Execute("Select cmp_name from cicmpy where cmp_code = 1945", Null, -1)
If (Not myRecordset.BOF) Then
myRecordset.MoveFirst
MsgBox myRecordset.Fields(0).Value
myRecordset.Close
End If
myAdo.Close
Set myAdo = Nothing
Exit Sub
ERR_HANDLER:
MsgBox Err.Description
Exit Sub
End Sub
My test customer number is 1945 and this code works. However, if I replace it with:
Private Sub Customer_LoseFocus(AllowLoseFocus As Boolean)
On Error GoTo ERR_HANDLER
Dim myAdo As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Set myAdo = Me.ConnInfpenADOConn
Set myRecordset = myAdo.Execute("Select cmp_name from cicmpy where cmp_code =" & me.Customer, Null, -1)
If (Not myRecordset.BOF) Then
myRecordset.MoveFirst
MsgBox myRecordset.Fields(0).Value
myRecordset.Close
End If
myAdo.Close
Set myAdo = Nothing
Exit Sub
ERR_HANDLER:
MsgBox Err.Description
Exit Sub
End Sub
Then I get an error saying "Object doesn't support this property or method"
Any ideas?
I am doing some testing in OE0101 because I want to add flex to prevent users from entering an order if a customer is over their credit limit (not just put the order on hold like Macola only allows). However, I've run into a stumbling block early on and I'm sure it's something stupid:
I am just trying to test passing the customer number to a query and returning a value from cicmpy just to see if it works. Here is my code:
Private Sub Customer_LoseFocus(AllowLoseFocus As Boolean)
On Error GoTo ERR_HANDLER
Dim myAdo As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Set myAdo = Me.ConnInfpenADOConn
Set myRecordset = myAdo.Execute("Select cmp_name from cicmpy where cmp_code = 1945", Null, -1)
If (Not myRecordset.BOF) Then
myRecordset.MoveFirst
MsgBox myRecordset.Fields(0).Value
myRecordset.Close
End If
myAdo.Close
Set myAdo = Nothing
Exit Sub
ERR_HANDLER:
MsgBox Err.Description
Exit Sub
End Sub
My test customer number is 1945 and this code works. However, if I replace it with:
Private Sub Customer_LoseFocus(AllowLoseFocus As Boolean)
On Error GoTo ERR_HANDLER
Dim myAdo As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Set myAdo = Me.ConnInfpenADOConn
Set myRecordset = myAdo.Execute("Select cmp_name from cicmpy where cmp_code =" & me.Customer, Null, -1)
If (Not myRecordset.BOF) Then
myRecordset.MoveFirst
MsgBox myRecordset.Fields(0).Value
myRecordset.Close
End If
myAdo.Close
Set myAdo = Nothing
Exit Sub
ERR_HANDLER:
MsgBox Err.Description
Exit Sub
End Sub
Then I get an error saying "Object doesn't support this property or method"
Any ideas?