Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dumping Values to Table with an autonumber done in cursor 1

Status
Not open for further replies.

lashwarj

IS-IT--Management
Nov 1, 2000
1,067
US
My code is below, how would i make a id field that puts numbers by the order they are in the list box. My table will consist or 3 fields, the Approval_id, Referal_Type, and PRINT_ORDER


WITH ThisForm.Referal_Types
FOR indx = 1 to .ListCount
SELECT approval_lk_referal
M.APPROVAL_ID = (Vapproval_id)
M.REFERAL_TYPE = .ListItem(.IndexToItemID(indx), 2)
INSERT INTO approval_lk_referal FROM MEMVAR
NEXT
ENDWITH
 
lashwarj,

I would think you could set a variable (M.PRINT_ORDER) to equal variable indx and use that in your PRINT_ORDER field.

Stewart
 
what would i declare indx to be equal to
 
indx is what you are using in the FOR...NEXT loop. It's just another variable so you can use it as you would any other variable.

So if you put the line M.PRINT_ORDER = indx before the INSERT INTO line, the field PRINT_ORDER will have each record's position in the listbox.

Stewart
 
Ok it sort of works, all I need to do is to get the Vapproval_id to change value, I have it setting it from the agenda list value, but I need it from all the values, like a chain of values.


meetingdate = CTOD(Thisform.meeting_date_value.value)
WITH ThisForm.Agenda_List
FOR indx = 1 to .ListCount
approval_num = VAL(Thisform.Agenda_List.Value)
SELECT approval_info
LOCATE FOR approval_num=approval_info.approval_num
Vapproval_id = approval_info.approval_id
SELECT agenda_order_info
M.MEETING_DATE = meetingdate
M.APPROVAL_ID = (Vapproval_id)
M.AGENDA_ORDER = indx
MESSAGEBOX(Vapproval_id)
INSERT INTO agenda_order_info FROM MEMVAR
NEXT
ENDWITH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top