Question Locked

Access Dlokup in VB

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a form with a listbox in it. When there is a change in that field I want the database to enter the date that change into another field based on what the status was changed to. ie...upon first entering a record that status field is changed to "initial entry". Once that choice is made i want the database to enter NOW() into the corresponding initial entry field. There is a 1 to 1 ration between the status_date field and the different statuses available in the listbox. I have been reading and there seems to be multiple ways to do this Select Case, if then else, etc. What is the best way?

3 replies

by mrmfoster

Hi

I would say Select Case is the best way. It will be easier to manage for the future for any updates etc and I think it looks better too.

When you say there is a one to one relationship between the status_date and the list box choices could some sort of formula be applied? Check out the formula Build for the control source of the control and the 'IIF' function. Its a bit similar to the excel If function.

Regards

Martin
MCP

by grtammi

And that's just it - my opinion, but I always really thought of the Access DLookup function as a simple way to get data from one field, in one table.

I think your best bet, as mentioned by Martin in the post before this, is to use a select case statement in conjunction with a SQL update statement to get your database to do what you need it to.

This discussion is closed to new replies.