Find an account peroid

  • Thread starter Thread starter johnb
  • Start date Start date
J

johnb

We have 13 accounting peroids in the financial year. When
new entry is made I need to show the acounting period for
that date on an AccessXP form. How do I approach this.
Should I use Dlookups, an SQL string, VBA or another
approach? An example will be great.

TIA
johnb
 
I've solved my own post. I think. Using SQL string

SELECT tbl_AP_Periods.AP, tbl_AP_Periods.StartDate,
tbl_AP_Periods.EndDate
FROM tbl_AP_Periods
WHERE (((tbl_AP_Periods.StartDate)<=forms![frm_NCR_data
v3]!restartdate) And ((tbl_AP_Periods.EndDate)>=forms!
[frm_NCR_data v3]!restartdate));

I'd welcome comments.
 
Hi,


You can base your form on a query so that a join would automatically
supply the associated data (autolookup) once the reference data is know.
Since the query will supply the field, in your form, that will appear as a
standard control.

A DLookup, through VBA, allows more flexibility, but creates a light
delay. In the after update event of the CONTROL for the "new entry" that can
allow to determine the "data" to look for additional data, write some code
like:


Me.OtherControl = DLookup("OtherDataOrExpression", "tableName",
"FieldName= FORMS!FormName!ControlName" )


where FormName and ControlName are the actual form and control names.



You may have to add the same code in the OnCurrent event of the FORM, so
that the same information is also "look up" each time you navigate through
records.



Hoping it may help,
Vanderghast, Access MVP
 
Thanks Vanderghast its a great help.
-----Original Message-----
Hi,


You can base your form on a query so that a join would automatically
supply the associated data (autolookup) once the reference data is know.
Since the query will supply the field, in your form, that will appear as a
standard control.

A DLookup, through VBA, allows more flexibility, but creates a light
delay. In the after update event of the CONTROL for the "new entry" that can
allow to determine the "data" to look for additional data, write some code
like:


Me.OtherControl = DLookup
("OtherDataOrExpression", "tableName",
 
Back
Top