Criminologist
Programmer
Some background about my project: I am accessing a Visual FoxPro Database Table through ODBC. I am using ADODC data controls and DataGrid controls to display the information.
I have 2 forms I am currently working with.
The first form (frmEvent) results from a doubleclick on a previous form, populating fields on frmEvent. This form allows a view of all information pertaining to an order except the actual products in the order itself. From this form, the user can press a button and have a second form (frmOrder) open up with all the products listed for the current order.
frmEvent:
Now I come to my problem. The button to access frmOrder on frmEvent is supposed to set the recordsource of the ADODC control on frmOrder based upon the work order number provided on frmEvent. The ADODC control then accesses my FoxPro table through ODBC and is supposed to display the correct information on a DataGrid control.
I have gone through and constructed the correct string to extract information from the database that I need, and to test it I have even hard coded this correct string into the ADODC properties and have had it work. When I took the RecordSource out, placed it into my code and set the work order number to be dynamically set, the ADODC control doesn't display my information. I know that my string is being constructed properly because I have paused my program and viewed the string construction in the immediate window.
I have tried several methods of getting the ADODC control to access the information correctly: I have tried using the ADODC.refresh method to attempt to have the control reaccess my information to no avail, placing the code to set the recordsource in the form_load event of frmOrder instead of the button control on frmEvent to no avail.
The strange part is after having my code set the RecordSource property of the control, I have paused the program and viewed the RecordSource through the immediate window and it is exactly as I need it to be!
I am getting very frustrated. I need to be able to change my ADODC contol on the fly and display my information correctly! If anyone can help, it would be greatly appreciated!
I have 2 forms I am currently working with.
The first form (frmEvent) results from a doubleclick on a previous form, populating fields on frmEvent. This form allows a view of all information pertaining to an order except the actual products in the order itself. From this form, the user can press a button and have a second form (frmOrder) open up with all the products listed for the current order.
frmEvent:
Code:
Private Sub Command2_Click()
frmOrder.lblCont.Caption = frmEvent.lblContNo.Caption
frmOrder.lblWO.Caption = frmEvent.lblWONo.Caption
frmOrder.lblTask.Caption = frmEvent.lblTask.Caption
frmOrder.lblTech.Caption = frmEvent.lblTech.Caption
frmOrder.lblDirect.Caption = frmMain.Adodc1.Recordset.Fields(18)
frmOrder.Adodc1.RecordSource = "Select rcwodt10.* From rcwodt10 Where _
(rcwodt10.workno = ' " & frmEvent.lblWONo.Caption & "' )"
frmOrder.Adodc1.Refresh
frmOrder.Show
End Sub
Now I come to my problem. The button to access frmOrder on frmEvent is supposed to set the recordsource of the ADODC control on frmOrder based upon the work order number provided on frmEvent. The ADODC control then accesses my FoxPro table through ODBC and is supposed to display the correct information on a DataGrid control.
I have gone through and constructed the correct string to extract information from the database that I need, and to test it I have even hard coded this correct string into the ADODC properties and have had it work. When I took the RecordSource out, placed it into my code and set the work order number to be dynamically set, the ADODC control doesn't display my information. I know that my string is being constructed properly because I have paused my program and viewed the string construction in the immediate window.
I have tried several methods of getting the ADODC control to access the information correctly: I have tried using the ADODC.refresh method to attempt to have the control reaccess my information to no avail, placing the code to set the recordsource in the form_load event of frmOrder instead of the button control on frmEvent to no avail.
The strange part is after having my code set the RecordSource property of the control, I have paused the program and viewed the RecordSource through the immediate window and it is exactly as I need it to be!
I am getting very frustrated. I need to be able to change my ADODC contol on the fly and display my information correctly! If anyone can help, it would be greatly appreciated!