forms - Subform issue ms access vba -
i writing because faced time consuming issue have not yet solved. connected ms access query , form data exchange. put in simple way. have following form: form
i have table cars , inside columns in order shown in q_cars query. have subform updated using particular comboboxes (currently 2 assigned) updating query using vba code (requery option). works if pick values both comboboxes only. can me find way put query criteria criterion empty combobox run query available data? tried use e.g. following structure inside criteria in query form:
iif( formularze![form]![t_id] <>""; «wyr» formularze![form]![t_id] ;>0)
or other attempts isempty, isnull function without success. know how solve issue? in version due language "," replaced ";" inside if structure. remaining code:
private sub btn_clear_click() me.t_brand.value = "" me.t_id.value = "" me.t_color = "" me.t_seats = "" q_cars_subform.requery end sub private sub t_brand_afterupdate() q_cars_subform.requery end sub private sub t_id_afterupdate() q_cars_subform.requery end sub
and table table regards, peter
query code:
select cars.car_id, cars.car_brand, cars.car_color, cars.car_seats cars (((cars.car_id)=iif(formularze!form!t_id<>"","«wyr» formularze![form]![t_id] ",(cars.car_id)>0)) , ((cars.car_brand)=formularze!form!t_brand));
that iif
contains invalid code.
you can use logical or
statement in where
criterium, no need iif
.
try following:
select cars.car_id, cars.car_brand, cars.car_color, cars.car_seats cars (cars.car_id = formularze![form]![t_id] or nz(formularze![form]![t_id]) = "") , (cars.car_brand = formularze!form!t_brand or nz(formularze!form!t_brand) = "");
note show if both empty, can adjust show nothing in case if needed.
Comments
Post a Comment