Ok here is what I have. I am using a table to store values for one value on another table. What I mean. My main table has customer information. One of the values of the main table is Rank (Military Rank). The table I'm working off is the Rank Table. This table looks like this.
Rank | Position (rank is "RT" position is "POS" in code.)
Mr. 1
Mrs. 2
AB 3
Amn. 4
A1C 5
Sra. 6
SSgt. 7
TSgt. 8
MSgt. 9
SMSgt. 10
CMSgt. 11
I made this table to be able to totally change the rank value. Say someone in the Navy needed a program like this....well those are Air Force Ranks/Titles. They'll need to change the values. (In case you are wondering...I use this table as a source for a listbox and/or drop down lists on different forms)
I've got the code done to add new value and delete a selected value. What I can't do is the move up or move down code. In order to change the position. What I basically have is a listbox with the values in it. In order based on position number. But the position number can't be seen or modified. So this is what I've written.
Just so you know "NRT" is for the selected value in the listbox.
Private Sub MD_Click() 'move down button
Do Until Recordset.EOF 'starts the loop
Recordset.MoveFirst 'goes to first recordset
If RT = NRT Then 'checks to see if the listbox value is in the recordset
POS = POS + 1 'if so it increases the pos number by 1
Do Until Recordset.EOF 'starts second loop
Recordset.MoveNext 'goes to next recordset
POS = POS + 1 'increases next value by 1
Loop
End If
Loop
RTLB.Requery 'requery the listbox that holds the values
End Sub
Everytime I run the code....it locks up the computer. I thought since the do loop was till EOF, it wouldn't cycle forever. I guess I'm wrong. Anyway, any help in the matter would be greatly appreciated.
Rank | Position (rank is "RT" position is "POS" in code.)
Mr. 1
Mrs. 2
AB 3
Amn. 4
A1C 5
Sra. 6
SSgt. 7
TSgt. 8
MSgt. 9
SMSgt. 10
CMSgt. 11
I made this table to be able to totally change the rank value. Say someone in the Navy needed a program like this....well those are Air Force Ranks/Titles. They'll need to change the values. (In case you are wondering...I use this table as a source for a listbox and/or drop down lists on different forms)
I've got the code done to add new value and delete a selected value. What I can't do is the move up or move down code. In order to change the position. What I basically have is a listbox with the values in it. In order based on position number. But the position number can't be seen or modified. So this is what I've written.
Just so you know "NRT" is for the selected value in the listbox.
Private Sub MD_Click() 'move down button
Do Until Recordset.EOF 'starts the loop
Recordset.MoveFirst 'goes to first recordset
If RT = NRT Then 'checks to see if the listbox value is in the recordset
POS = POS + 1 'if so it increases the pos number by 1
Do Until Recordset.EOF 'starts second loop
Recordset.MoveNext 'goes to next recordset
POS = POS + 1 'increases next value by 1
Loop
End If
Loop
RTLB.Requery 'requery the listbox that holds the values
End Sub
Everytime I run the code....it locks up the computer. I thought since the do loop was till EOF, it wouldn't cycle forever. I guess I'm wrong. Anyway, any help in the matter would be greatly appreciated.