Please help. This is driving me crazy.
I extract some fields from an Access 2000 database. As it says in the notes, I extract one field several times and use it as basis for 3 more fields that I derive in my code (hoakey I know). My problem is that even though the datacombo boxes that each field is being put into are exactly alike except for name; one does not work and the other two do. The code that I am using is exactly the same for the first field (which does not work) as it is for the third field (which does). On the second field I do a trim and it also works, but even when I trim the first field it does not work. I am extracting a 255 character field and putting 100 character values in them.
This is the code
sqlPurchaseOrderWhenID = _
"Select purchase_order_num, builder_id, subdivision_id, address_id, " & _
"purchase_order_print_notes, purchase_order_internal_notes, " & _
"purchase_order_active, " & _
"purchase_order_print_notes AS purchase_order_builder_name, " & _
"purchase_order_print_notes AS purchase_order_subdivision_name, " & _
"purchase_order_print_notes AS purchase_order_search_address " & _
"FROM Purchase_Orders where purchase_order_id = " & _
PurchaseOrderID
'The selection of purchase_order_num four times, are to create placeholders for
'those pieces of data in a recordset. This is to allow me to force the
'datacombo boxes to accept the the data I want to put into it's text
Set rsPurchaseOrders = New ADODB.Recordset
rsPurchaseOrders.CursorLocation = adUseClient
rsPurchaseOrders.Open sqlPurchaseOrderWhenID, adoConnect, adOpenDynamic, adLockOptimistic
With rsPurchaseOrders
If !address_id > 0 Then
!purchase_order_search_address = GetAddressWhenID(!address_id)
Set dcPOAddressfrPurchaseOrders.DataSource = rsPurchaseOrders
dcPOAddressfrPurchaseOrders.ListField = "purchase_order_search_address"
dcPOAddressfrPurchaseOrders.Text = !purchase_order_search_address
End If
If !builder_id > 0 Then
!purchase_order_builder_name = GetBuilderNameWhenID(!builder_id)
Set dcBuilderfrPurchaseOrders.RowSource = rsPurchaseOrders
dcBuilderfrPurchaseOrders.ListField = "purchase_order_builder_name"
dcBuilderfrPurchaseOrders.Text = Trim(!purchase_order_builder_name)
End If
If !subdivision_id > 0 Then
!purchase_order_subdivision_name = GetSubdivisionNameWhenID(!subdivision_id)
Set dcSubdivisionfrPurchaseOrders.RowSource = rsPurchaseOrders
dcSubdivisionfrPurchaseOrders.ListField = "purchase_order_subdivision_name"
dcSubdivisionfrPurchaseOrders.Text = !purchase_order_subdivision_name
The functions that I use GetBuilderNameWhenID,... work correctly and the string is returned. I verify that it is in the recordset correctly as the Value. The original value is wrong, but shouldn't make any difference, right?
Everything works perfectly until the line :
dcPOAddressfrPurchaseOrders.text = !purchase_order_search_address
There are no errors, it just doesn't pick up the value from the recordset field. I use this scheme everywhere in my program and it works everywhere else except for this one datacombo box. I have checked it and rechecked it. I have deleted it and recreated it. I can't figure this one out. Please help asap. Thanks in advance.
I extract some fields from an Access 2000 database. As it says in the notes, I extract one field several times and use it as basis for 3 more fields that I derive in my code (hoakey I know). My problem is that even though the datacombo boxes that each field is being put into are exactly alike except for name; one does not work and the other two do. The code that I am using is exactly the same for the first field (which does not work) as it is for the third field (which does). On the second field I do a trim and it also works, but even when I trim the first field it does not work. I am extracting a 255 character field and putting 100 character values in them.
This is the code
sqlPurchaseOrderWhenID = _
"Select purchase_order_num, builder_id, subdivision_id, address_id, " & _
"purchase_order_print_notes, purchase_order_internal_notes, " & _
"purchase_order_active, " & _
"purchase_order_print_notes AS purchase_order_builder_name, " & _
"purchase_order_print_notes AS purchase_order_subdivision_name, " & _
"purchase_order_print_notes AS purchase_order_search_address " & _
"FROM Purchase_Orders where purchase_order_id = " & _
PurchaseOrderID
'The selection of purchase_order_num four times, are to create placeholders for
'those pieces of data in a recordset. This is to allow me to force the
'datacombo boxes to accept the the data I want to put into it's text
Set rsPurchaseOrders = New ADODB.Recordset
rsPurchaseOrders.CursorLocation = adUseClient
rsPurchaseOrders.Open sqlPurchaseOrderWhenID, adoConnect, adOpenDynamic, adLockOptimistic
With rsPurchaseOrders
If !address_id > 0 Then
!purchase_order_search_address = GetAddressWhenID(!address_id)
Set dcPOAddressfrPurchaseOrders.DataSource = rsPurchaseOrders
dcPOAddressfrPurchaseOrders.ListField = "purchase_order_search_address"
dcPOAddressfrPurchaseOrders.Text = !purchase_order_search_address
End If
If !builder_id > 0 Then
!purchase_order_builder_name = GetBuilderNameWhenID(!builder_id)
Set dcBuilderfrPurchaseOrders.RowSource = rsPurchaseOrders
dcBuilderfrPurchaseOrders.ListField = "purchase_order_builder_name"
dcBuilderfrPurchaseOrders.Text = Trim(!purchase_order_builder_name)
End If
If !subdivision_id > 0 Then
!purchase_order_subdivision_name = GetSubdivisionNameWhenID(!subdivision_id)
Set dcSubdivisionfrPurchaseOrders.RowSource = rsPurchaseOrders
dcSubdivisionfrPurchaseOrders.ListField = "purchase_order_subdivision_name"
dcSubdivisionfrPurchaseOrders.Text = !purchase_order_subdivision_name
The functions that I use GetBuilderNameWhenID,... work correctly and the string is returned. I verify that it is in the recordset correctly as the Value. The original value is wrong, but shouldn't make any difference, right?
Everything works perfectly until the line :
dcPOAddressfrPurchaseOrders.text = !purchase_order_search_address
There are no errors, it just doesn't pick up the value from the recordset field. I use this scheme everywhere in my program and it works everywhere else except for this one datacombo box. I have checked it and rechecked it. I have deleted it and recreated it. I can't figure this one out. Please help asap. Thanks in advance.