Should you be using IsDate() instead of Null just in case?
Should you be using IsDate() instead of Null just in case?
Hi Bulzie, thank you for those reply,You need to also limit it to just those without values already so your Where clause would be:
WHERE (((No_HOP_BNC.Date_HOP) Is Not Null) AND ((No_HOP_BNC.Texte19) Is Null));"
Also do aRequery at the end to have it display on the form after you hit the button and do the Update.
Forms![No_HOP_BNC].Requery
I`m still very noob into those sort of thing, but what I know is the form is linked to a table called No_HOP_BNC (as you can see in the code)
and adding a requery would be hard for me to do so (or don`t really understand how i should approach it)
I found this way can make the job done:
with this code,
the user will first have to enter the 8 digits in the No BC first, and whenever the user click on the date box, today`s date will be entered and also the 8 digits from the No BC will ba pasted.
It`s not what I wanted ayt first but i guess it can make the job done,
It seems more professional, having to click a button and then fill out the field where it contains a date though.
see below when i click on the date box, No BC will be filled up for me
but i ll have to click on every row to make it happens, instead of 1 click of a button and filled out for me
Not sure where the translation is off. I tested the below and it works. The code below directly updates the table with the value in the text box. It does not enter them through the form. Then the Requery refreshes the screen so those values now show on your form. Get rid of the other stuff in the OnClick of the Test button and paste in the 4 lines of code below.
DoCmd.SetWarnings = False
DoCmd.RunSQL "UPDATE No_HOP_BNC SET No_HOP_BNC.texte19 = [Forms]![YourFormName]![txt_BC] WHERE (((No_HOP_BNC.Date_HOP) Is Not Null) AND ((No_HOP_BNC.Texte19) Is Null));"
Forms![YourFormName].Requery
DoCmd.SetWarnings = True
In the above code:
1. Replace YourFormName with the actual name of your form.
2. texte19 is the name of your text box.
3. txt_BC is the field in your table you are writing this value.
4. No_HOP_BNC is the name of the table
5. Date_HOP is the name of the date field
I don`t understand what you mean by aRequery: here`s what the code is in the test button so far,You need to also limit it to just those without values already so your Where clause would be:
WHERE (((No_HOP_BNC.Date_HOP) Is Not Null) AND ((No_HOP_BNC.Texte19) Is Null));"
Also do aRequery at the end to have it display on the form after you hit the button and do the Update.
Forms![No_HOP_BNC].Requery
but the code seems to be bugging in that line:
Reread Post #18, remove that code in the button and replace with the 4 lines I indicated in Post #18. Make sure to read all I wrote and change YourFormName with the actual name of your form.