0
아래 내 컨트롤 소스이며 작동합니다을 DLookup 컨트롤 원본과 같은 VBA 코드를 통해
=IIf(Forms!GARF!GARFsubForm![finished_good_#]<>"",DLookUp("[CustomerSKU]","ItemCustomerSKU","ItemNumber = '" & Forms!GARF!GARFsubForm![finished_good_#] & "' AND Customer = '" & Forms!GARF!customer & "' AND Company = '" & Forms!GARF!company & "' AND MarketingSeason = '" & DLookUp("[Code]","IDtoCode","ID = " & Forms!GARF!season_id) & "' AND Season = " & Forms!GARF!GARFyear),"")
I는 같은 VBA 코드를 통해 다른 제어 소스에 할당하고 싶은
:
Forms![GARF]![GARFsubForm]![SKU].ControlSource = (the above code)
Forms![GARF]![GARFsubForm]![SKU]
데이터 시트의 열입니다.
UPDATE : Remou의 도움으로 나는 아래 작업 솔루션을 마련 할 수 있었다 : 코드는 Form_Load 이벤트에 :
Forms![GARF]![GARFsubForm]![SKU].ControlSource =
"=IIf(Forms!GARF!GARFsubForm![finished_good_#]<>'',"
& "DLookUp(""[CustomerSKU]"",""ItemCustomerSKU"",""ItemNumber = '""
& Forms!GARF!GARFsubForm![finished_good_#] & ""' AND Customer = '" _
& Forms!GARF!customer & "' AND Company = '" _
& Forms!GARF!company & "' AND Season = " & Forms!GARF!GARFyear _
& " AND MarketingSeason = '"
& DLookup("[Code]", "IDtoCode", "ID = " & Forms!GARF!season_id) & "'"")" & ",'')"
두 번째 DLookUp에 대해 몇 가지 따옴표가 누락되었습니다. 문자열을 별도로 구성하는 방법을 보여주기 위해 추가 참고를 추가했습니다. – Fionnuala
@ 브루노 내 노트를 업데이트했습니다. BTW 단일 문자 변수는 완성 된 코드에 적합하지 않지만 테스트에 유용합니다. – Fionnuala
감사합니다. 이제 CustomerSKU 열의 모든 행에 첫 번째 레코드의 SKU 번호가 표시됩니다. 코드를 업데이트했습니다. – Bruno