A
Alex
I have the following code in the AfterUpdate event of the Part combobox, it
works as expected and I can save, close and reopen the form with field values
still in tact:
Me.Ref_Part_NHL = DLookup("[AS Part#]", "ExcelARefParts", "[PART#] =
[RefPart] And [Variable] > 0 And [Part#] <> [AS Part#] And [Model#] =
[Model]")
However, if I add the following (along with the above code), I'm getting
error that there's a null primary key when I try and close my form.
Me.Ref_Part_Weight_lb = DLookup("[FIN WTLB]", "ExcelARefParts", "[PART#] =
[RefPart] And [Variable] > 0 And [Part#] <> [AS Part#] And [Model#] =
[Model]")
My form's data source is a query with AllParts, ExcelARefParts,
ExcelBRefParts and PO tables. The query contains left joins in which All
AllParts records are returned and only matching ones for the other three
tables.
Could the error message appear because the Ref_Part_Weight_lb field is not
saved to the AllParts table? The information is in the ExcelARefparts table
so I don't think I want to duplicate efforts and save it to the AllParts
table too do I?
The only reason I'm using dlookup is because I need to immediately refresh
some fields like Ref_Part_Weight_lb when a choice is made from a combo box
called Part. The Part combo box includes all Parts from the ExcelARefParts.
All I'm trying to do is if, for example, user chooses Part 1234 I want the
Ref Part Weight lb for that same record to populate. Part is saved to the
AllParts table. I know I can refresh the entire form but that consists of
either closing and reopening the form, which will bounce to the first record
or I've tried using the following code, which refreshes, but filters the
recordset to only that record.
strDocName = "NewPartInputfrm"
DoCmd.OpenForm strDocName, , , "[ID] = " & IDctr
I just want the form to refresh as soon as a Part is selected without moving
to another record. I can't imagine that it's this hard? Thanks for your
help.
works as expected and I can save, close and reopen the form with field values
still in tact:
Me.Ref_Part_NHL = DLookup("[AS Part#]", "ExcelARefParts", "[PART#] =
[RefPart] And [Variable] > 0 And [Part#] <> [AS Part#] And [Model#] =
[Model]")
However, if I add the following (along with the above code), I'm getting
error that there's a null primary key when I try and close my form.
Me.Ref_Part_Weight_lb = DLookup("[FIN WTLB]", "ExcelARefParts", "[PART#] =
[RefPart] And [Variable] > 0 And [Part#] <> [AS Part#] And [Model#] =
[Model]")
My form's data source is a query with AllParts, ExcelARefParts,
ExcelBRefParts and PO tables. The query contains left joins in which All
AllParts records are returned and only matching ones for the other three
tables.
Could the error message appear because the Ref_Part_Weight_lb field is not
saved to the AllParts table? The information is in the ExcelARefparts table
so I don't think I want to duplicate efforts and save it to the AllParts
table too do I?
The only reason I'm using dlookup is because I need to immediately refresh
some fields like Ref_Part_Weight_lb when a choice is made from a combo box
called Part. The Part combo box includes all Parts from the ExcelARefParts.
All I'm trying to do is if, for example, user chooses Part 1234 I want the
Ref Part Weight lb for that same record to populate. Part is saved to the
AllParts table. I know I can refresh the entire form but that consists of
either closing and reopening the form, which will bounce to the first record
or I've tried using the following code, which refreshes, but filters the
recordset to only that record.
strDocName = "NewPartInputfrm"
DoCmd.OpenForm strDocName, , , "[ID] = " & IDctr
I just want the form to refresh as soon as a Part is selected without moving
to another record. I can't imagine that it's this hard? Thanks for your
help.