Office VBA Macros You Can Use Today phần 9

sửa chữa đó. Khi lựa chọn tất cả các hồ sơ, toàn bộ mệnh đề WHERE có thể được giảm xuống. Phần thứ hai sử dụng các vòng lặp xử lý kỷ lục tiêu chuẩn và bắt đầu thử nghiệm nếu có hồ sơ được lựa chọn bằng cách sử dụng IF VÀ THEN. IF có vẻ kỳ quặc, | Access Procedures corrects that. When selecting all records the whole WHERE clause can be dropped. The second section uses the standard record processing loop and starts with testing if there are records selected using IF AND THEN. The IF looks odd perhaps but it is short for IF True. As both EOF End Of File and BOF Beginning Of File are Boolean values they can only hold True or False. Note Testing to ensure that records are selected should always be coded so that there is at least one record to process in the loop. When there is no record the that is intended to set the cursor to the first record will fail. Within the WHILE WEND loop the last statement is to ensure that a new record is processed the next time. If this statement is omitted the loop will run forever. Making a Rolodex-type Selection List Box This procedure demonstrates how to use a datasheet tabbed like a Rolodex using the first character of the names. Acs ----- --- TT---------- 7---------------- Scenario A rather intuitive way of selecting names is to use a tabbed list to do the selection. There is a tabbed control in Access but making 26 separate controls and controlling them requires a lot of code. It is possible to mimic such a control by using a list box and the selected letter to do the filtering. Example file with a form frmNameSelect page 346 Office VBA Macros You Can Use Today Access Procedures Figure 90 - Rolodex-style Selection Looking closely at this form reveals that the button of the record navigation buttons at the bottom is activated. To test the dynamic nature of the datasheet and the changes in the added list box the subforms data properties have been set to allow for the Insert Update and Deletion of records. Just click the subform twice and open the properties window as shown in Figure 91. Acs Office VBA Macros You Can Use Today page 347 Access Procedures Acs Figure 91 - Form Properties Window All of the Allow .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.