Hi
Sorry to keep asking questions but I keep getting a run-time error 2001 "you canceled the previous operation" error whenever the code in the Dlookup line is reached. I have a table called Alphabet_lookup that I'm simply trying to extract a letter from depending on the value of counter . I first thought that "Letter" might be a reserved word so I changed the field name and still get the same error.
It's frustrating spending an entire afternoon on something like this. Thanks for any help.
Splits = Val([Forms]![Splits_Form]![Number_of_Split s_Textbox])
COUNTER = 1
Dim ltr As String
Do
Do While COUNTER <= Splits
ltr = DLookup("[LETTER]", "Alphabet_looku p", "[split_num] = Counter")
Set db = CurrentDb
Set rs = db.OpenRecordse t("Count_Statio ns")
rs.AddNew
rs("PCID") = DMax("[PCID]", "Count_Stations ") + 1
rs("Counting_S" ) = Forms!count_sta tions_form!COUN TING_S & ltr & "-" & get_global("g_g roup")
rs("Street") = Forms!count_sta tions_form!STRE ET
rs("Cross_St1" ) = Forms!count_sta tions_form!CROS S_ST1
rs("Cross_St2" ) = Forms!count_sta tions_form!CROS S_ST2
rs("Cnty_fips" ) = Forms!count_sta tions_form!CNTY _FIPS
rs("Status") = "add/split"
rs("Action_Note ") = "ADD:as per SPLIT"
rs("Creation_da te") = Date
rs.Update
rs.Close
If COUNTER = Splits Then
done = yes
Exit Do
End If
COUNTER = COUNTER + 1
Loop
Loop Until done = yes
Sorry to keep asking questions but I keep getting a run-time error 2001 "you canceled the previous operation" error whenever the code in the Dlookup line is reached. I have a table called Alphabet_lookup that I'm simply trying to extract a letter from depending on the value of counter . I first thought that "Letter" might be a reserved word so I changed the field name and still get the same error.
It's frustrating spending an entire afternoon on something like this. Thanks for any help.
Splits = Val([Forms]![Splits_Form]![Number_of_Split s_Textbox])
COUNTER = 1
Dim ltr As String
Do
Do While COUNTER <= Splits
ltr = DLookup("[LETTER]", "Alphabet_looku p", "[split_num] = Counter")
Set db = CurrentDb
Set rs = db.OpenRecordse t("Count_Statio ns")
rs.AddNew
rs("PCID") = DMax("[PCID]", "Count_Stations ") + 1
rs("Counting_S" ) = Forms!count_sta tions_form!COUN TING_S & ltr & "-" & get_global("g_g roup")
rs("Street") = Forms!count_sta tions_form!STRE ET
rs("Cross_St1" ) = Forms!count_sta tions_form!CROS S_ST1
rs("Cross_St2" ) = Forms!count_sta tions_form!CROS S_ST2
rs("Cnty_fips" ) = Forms!count_sta tions_form!CNTY _FIPS
rs("Status") = "add/split"
rs("Action_Note ") = "ADD:as per SPLIT"
rs("Creation_da te") = Date
rs.Update
rs.Close
If COUNTER = Splits Then
done = yes
Exit Do
End If
COUNTER = COUNTER + 1
Loop
Loop Until done = yes
Comment