Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Greetings.
I have a question about selecting the same value across multiple date fields.
In this document, all the tables have a date field (DATE_CREATE, DATE_SOLD, CRT_DATE, etc). There about 10 different ones. I have applied the Year and Month function to each one but I dont want to link the tables by dates, otherwise I would get the synthetic keys.
What I would like to do is maybe have a macro that if I select May on my Sales table, it would automatically select the May month corresponding to the Receipts table. Is there a way of doing this?
I tried the ActiveDocument(Receipt.DATE_CREATE).Select = ActiveDocument(Sales.DATE_SOLD).Select, but of course was not correct.
Hi
You would need to do something like:
SET mySelections = ActiveDocument.Fields("Sales.DATE_SOLD").GetSelectedValues
ActiveDocument.Fields("Receipt.DATE_CREATE").Select mySelections.Item(0).text
ActiveDocument.Fields("CRT_DATE").Select mySelections.Item(0).text
Good luck,
Hi
You would need to do something like:
SET mySelections = ActiveDocument.Fields("Sales.DATE_SOLD").GetSelectedValues
ActiveDocument.Fields("Receipt.DATE_CREATE").Select mySelections.Item(0).text
ActiveDocument.Fields("CRT_DATE").Select mySelections.Item(0).text
Good luck,
When I press the clear all button, I get the following error with the macro.
"Invalid procedure call or argument"
Can I suppress this, otherwise it is working like a charm.
Here's my code to synchronize a second set of date fields in the background in a live application. Each subroutine is executed onSelect or onChange of the associated field. I don't have any problems with the clear button.
sub setDate()
ActiveDocument.getField("Display Date").selectValues ActiveDocument.getField("Date").getSelectedValues(1200)
end sub
sub setWeek()
ActiveDocument.getField("Display Week").selectValues ActiveDocument.getField("Week").getSelectedValues(500)
end sub
sub setMonth()
ActiveDocument.getField("Display Month").selectValues ActiveDocument.getField("Month").getSelectedValues
end sub
sub setQuarter()
ActiveDocument.getField("Display Quarter").selectValues ActiveDocument.getField("Quarter").getSelectedValues
end sub
sub setYear()
ActiveDocument.getField("Display Year").selectValues ActiveDocument.getField("Year").getSelectedValues
end sub
John,
Do you see anything wrong with the following code?
Sub SelectYear
ActiveDocument.Fields("Receipts.Year").selectValues ActiveDocument.Fields("Year").GetSelectedValues
ActiveDocument.Fields("Inventory.Year").selectValues ActiveDocument.Fields("Year").GetSelectedValues
End Sub
Sub SelectMonth
ActiveDocument.Fields("Receipts.Month").selectValues ActiveDocument.Fields("FiscalMonth").GetSelectedValues
ActiveDocument.Fields("Inventory.Month").selectValues ActiveDocument.Fields("FiscalMonth").GetSelectedValues
End Sub
Year works fine, it cascades my selections across, but when I select month it makes the one selection for FiscalMonth and doesn't pass to my Receipts or Inventory dates.
Nothing is jumping out at me as wrong with that, sorry.