Default Value in Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

using Access 2007 Windows XP

I'm attempting to insert a default value in a control on a form
(frmCashrcpt) the control is CURDATE. On the form OnOpen command I have this:

Private Sub Form_Open(Cancel As Integer)

Me!CURDATE.DefaultValue = """" & DLookup = (fairdate!tblfairdate) & """"

End Sub

However, it's telling me that is is a compile error and DLookup is not an
option.

Huh?

Appreciate any help.
 
I changed the statement to read and this works:

Me!CURDATE.DefaultValue = """" & DLookup("fairdate", "tblFairdate") & """"

Now my question, the qryCashRcpts that this form runs on, I need to limit
the information to just the date that is currently the fairdate. How do I
change my criteria to reflect fairdate.tblfairdate on the control Curdate.
mind you there is no relationship between these two tables.
 
Maybe you could use a form filter.
If you place a button on your form you code place some code behind it like:

me.filter=me.curdate
me.filteron=true

hth
 
Back
Top