Below is my code, what I have it doing it taking a grid that has no bound control sources and after it runs the code it sets it. It works as long as you return values, but if you end up getting 0 in the temptable and the message box is prompt it no longer allows you to click and set the value.
I have a field on the form, in the click event of the columns i have it setting that value to = the value of column 4, runs great you can run it as many times as you want as long as you return values, after the first empty temptable is generated, all values appear correctly, but you can no longer have the click event of the columns set the value.
IF Name_Search = 1 AND Approval_Search = 0 AND Tax_Map_Search = 0
Lookup_Last_Name = UPPER(ALLTRIM(Thisform.Requested_Last_Name.Value))
Lookup_First_Name = UPPER(ALLTRIM(Thisform.Requested_First_Name.Value))
LookUp_Full_Name = UPPER(Lookup_First_Name + ' ' + Lookup_Last_Name)
SELECT na_names
REQUERY('na_names')
ENDIF
IF EMPTY(LookUp_Last_Name) AND EMPTY(LookUp_First_Name)
MESSAGEBOX('Please enter a name to search for',16,'Notice')
ELSE
IF !EMPTY(Lookup_Last_Name) AND !EMPTY(LookUp_First_Name)
SELECT pc_parcel.p_id, pc_parcel.prior_pc, pc_address.formated_address, na_names.free_line_1 ;
FROM na_names INNER JOIN pc_owner ;
ON na_names.na_id = pc_owner.na_id ;
INNER JOIN pc_parcel ;
ON pc_parcel.p_id = pc_owner.p_id ;
INNER JOIN pc_address ;
ON pc_parcel.p_id = pc_address.p_id ;
WHERE UPPER(na_names.free_line_1) = PADR(LookUp_Full_Name,50) AND UPPER(pc_owner.status) = 'O';
INTO CURSOR temptable ORDER BY pc_parcel.prior_pc ASC
Thisform.select_button.Visible = .T.
ELSE
IF !EMPTY(Lookup_Last_Name) AND EMPTY(LookUp_First_Name)
SELECT pc_parcel.p_id, pc_parcel.prior_pc, pc_address.formated_address, na_names.free_line_1 ;
FROM na_names INNER JOIN pc_owner ;
ON na_names.na_id = pc_owner.na_id ;
INNER JOIN pc_parcel ;
ON pc_parcel.p_id = pc_owner.p_id ;
INNER JOIN pc_address ;
ON pc_parcel.p_id = pc_address.p_id ;
WHERE UPPER(na_names.last_name) = PADR(LookUp_last_Name,50) AND UPPER(pc_owner.status) = 'O' ;
INTO CURSOR temptable ORDER BY pc_parcel.prior_pc ASC
Thisform.select_button.Visible = .T.
ENDIF
ENDIF
ENDIF
IF Name_Search = 1 AND Approval_Search = 0 AND Tax_Map_Search = 0
IF !EMPTY(Lookup_Last_Name) OR !EMPTY(Lookup_First_Name )
Thisform.result_grid.RecordSource = 'temptable'
Thisform.result_grid.column1.ControlSource = 'temptable.prior_pc'
Thisform.result_grid.column1.Alignment = 3
Thisform.result_grid.column1.FontSize = 8
Thisform.result_grid.column1.FontBold = .F.
Thisform.result_grid.column1.ForeColor =0
Thisform.result_grid.column1.Width = 105
Thisform.result_grid.column1.header1.Caption = 'Tax Map #'
Thisform.result_grid.column2.ControlSource = 'temptable.formated_address'
Thisform.result_grid.column2.Alignment = 3
Thisform.result_grid.column2.FontSize = 8
Thisform.result_grid.column2.FontBold = .F.
Thisform.result_grid.column2.ForeColor =0
Thisform.result_grid.column2.Width = 145
Thisform.result_grid.column2.header1.Caption = 'Location'
Thisform.result_grid.column3.ControlSource = 'temptable.free_line_1'
Thisform.result_grid.column3.Alignment = 3
Thisform.result_grid.column3.FontSize = 8
Thisform.result_grid.column3.FontBold = .F.
Thisform.result_grid.column3.ForeColor =0
Thisform.result_grid.column3.Width = 170
Thisform.result_grid.column3.header1.Caption = 'Owner'
Thisform.result_grid.column4.ControlSource = 'temptable.p_id'
Thisform.result_grid.column4.Alignment = 3
Thisform.result_grid.column4.FontSize = 8
Thisform.result_grid.column4.FontBold = .F.
Thisform.result_grid.column4.ForeColor =0
Thisform.result_grid.column4.Width = 1
Thisform.result_grid.column4.header1.Caption = ''
Thisform.result_Grid.Refresh()
Thisform.Refresh()
counter = RECCOUNT('temptable')
IF counter > 0
Thisform.Height = 400
ELSE
MESSAGEBOX(Lookup_Full_Name + ' is not in the system',16,'Notice')
ENDIF
ENDIF
ENDIF
I have a field on the form, in the click event of the columns i have it setting that value to = the value of column 4, runs great you can run it as many times as you want as long as you return values, after the first empty temptable is generated, all values appear correctly, but you can no longer have the click event of the columns set the value.
IF Name_Search = 1 AND Approval_Search = 0 AND Tax_Map_Search = 0
Lookup_Last_Name = UPPER(ALLTRIM(Thisform.Requested_Last_Name.Value))
Lookup_First_Name = UPPER(ALLTRIM(Thisform.Requested_First_Name.Value))
LookUp_Full_Name = UPPER(Lookup_First_Name + ' ' + Lookup_Last_Name)
SELECT na_names
REQUERY('na_names')
ENDIF
IF EMPTY(LookUp_Last_Name) AND EMPTY(LookUp_First_Name)
MESSAGEBOX('Please enter a name to search for',16,'Notice')
ELSE
IF !EMPTY(Lookup_Last_Name) AND !EMPTY(LookUp_First_Name)
SELECT pc_parcel.p_id, pc_parcel.prior_pc, pc_address.formated_address, na_names.free_line_1 ;
FROM na_names INNER JOIN pc_owner ;
ON na_names.na_id = pc_owner.na_id ;
INNER JOIN pc_parcel ;
ON pc_parcel.p_id = pc_owner.p_id ;
INNER JOIN pc_address ;
ON pc_parcel.p_id = pc_address.p_id ;
WHERE UPPER(na_names.free_line_1) = PADR(LookUp_Full_Name,50) AND UPPER(pc_owner.status) = 'O';
INTO CURSOR temptable ORDER BY pc_parcel.prior_pc ASC
Thisform.select_button.Visible = .T.
ELSE
IF !EMPTY(Lookup_Last_Name) AND EMPTY(LookUp_First_Name)
SELECT pc_parcel.p_id, pc_parcel.prior_pc, pc_address.formated_address, na_names.free_line_1 ;
FROM na_names INNER JOIN pc_owner ;
ON na_names.na_id = pc_owner.na_id ;
INNER JOIN pc_parcel ;
ON pc_parcel.p_id = pc_owner.p_id ;
INNER JOIN pc_address ;
ON pc_parcel.p_id = pc_address.p_id ;
WHERE UPPER(na_names.last_name) = PADR(LookUp_last_Name,50) AND UPPER(pc_owner.status) = 'O' ;
INTO CURSOR temptable ORDER BY pc_parcel.prior_pc ASC
Thisform.select_button.Visible = .T.
ENDIF
ENDIF
ENDIF
IF Name_Search = 1 AND Approval_Search = 0 AND Tax_Map_Search = 0
IF !EMPTY(Lookup_Last_Name) OR !EMPTY(Lookup_First_Name )
Thisform.result_grid.RecordSource = 'temptable'
Thisform.result_grid.column1.ControlSource = 'temptable.prior_pc'
Thisform.result_grid.column1.Alignment = 3
Thisform.result_grid.column1.FontSize = 8
Thisform.result_grid.column1.FontBold = .F.
Thisform.result_grid.column1.ForeColor =0
Thisform.result_grid.column1.Width = 105
Thisform.result_grid.column1.header1.Caption = 'Tax Map #'
Thisform.result_grid.column2.ControlSource = 'temptable.formated_address'
Thisform.result_grid.column2.Alignment = 3
Thisform.result_grid.column2.FontSize = 8
Thisform.result_grid.column2.FontBold = .F.
Thisform.result_grid.column2.ForeColor =0
Thisform.result_grid.column2.Width = 145
Thisform.result_grid.column2.header1.Caption = 'Location'
Thisform.result_grid.column3.ControlSource = 'temptable.free_line_1'
Thisform.result_grid.column3.Alignment = 3
Thisform.result_grid.column3.FontSize = 8
Thisform.result_grid.column3.FontBold = .F.
Thisform.result_grid.column3.ForeColor =0
Thisform.result_grid.column3.Width = 170
Thisform.result_grid.column3.header1.Caption = 'Owner'
Thisform.result_grid.column4.ControlSource = 'temptable.p_id'
Thisform.result_grid.column4.Alignment = 3
Thisform.result_grid.column4.FontSize = 8
Thisform.result_grid.column4.FontBold = .F.
Thisform.result_grid.column4.ForeColor =0
Thisform.result_grid.column4.Width = 1
Thisform.result_grid.column4.header1.Caption = ''
Thisform.result_Grid.Refresh()
Thisform.Refresh()
counter = RECCOUNT('temptable')
IF counter > 0
Thisform.Height = 400
ELSE
MESSAGEBOX(Lookup_Full_Name + ' is not in the system',16,'Notice')
ENDIF
ENDIF
ENDIF