Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with auto filling a field- please

Status
Not open for further replies.

LowBrow

Technical User
Jun 1, 2001
100
US
I added a thread yesterday, but maybe I didn't explain my situation correctly. I want to fill a text box with a value of '1' if there is no previous record in the table for the client currently selected on the date currently selected. If there is another record that meets the current criteria, then the field should be left null. Any help would be much appreciated.
For info on what I have tried, please see the thread titled
'Autofill a field based on criteria entered in previous records' I posted yesterday (6/13/01).
Thank you
 
If I have more than 1 entry per a particular client per a particular day, and 1 is set as the default value, then I end up billing 1 day of service as 2 days of service.
I have forty clients I am entering time for daily, and I may not enter them consecutively, or I may enter time today for service services rendered yesterday, or last week. I need the db to allow or disallow a default entry depending on entries for the form current client for the form current day.
 
Maybe you can try through a recordset.

Exp. form1, on txtName_afterupdate
set db= currentdb
set rs = db.openrecordset ("Select * from table where date = ....")

If rs.recordcount > 0 then
form1.fieldname.value = "0"
Else
form1.fieldname.value = "1"
End If

rs.close

All the syntaxs you need to check yourself to make sure it follows the rule or else it might not work.

For more info on this,

Good Luck!
 
Thanks for the help. I think I am getting closer. With the code above, and using a find duplicates query, I think I am getting it. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top