Well the syntax shown is correct, so either your field names are incorrect, or something else is wrong.
Can you post up a sample of the form and enough data to demonstrate.
Or a picture of the controls properties?
Well the syntax shown is correct, so either your field names are incorrect, or something else is wrong.
Can you post up a sample of the form and enough data to demonstrate.
Or a picture of the controls properties?
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
If I write this: =Format([fecha_entDT]) & "-" & [CODIGO_planta] & "-" & [id_item] it works fine, but it shows: 20/03/2019 11:57:56-NA-120
I have changed fecha_entDT format in field properties in my table to yyyymmdd. If I go to my form in which this field is in it, it shows correctly this format, but when I click on it appear this date: 20/03/2019 11:57:56. I think that the problem is that access (somehow) take that long date format instead of yyyymmdd.
Please, in general, don't format anything at a table level, it will give you a world of pain further down the line.
Formatting like that only applies when viewing the data, and as you should never view table data directly is therefore pointless and confusing.
You should always apply formatting at the report or from level when you need it.
Remove the table formatting, and go back to my original answer.
To prove that the format works in the immediate window in the VBA editor type
You should get 20190320Code:? Format(Date(),"yyyymmdd")
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
Ok, I deleted the formatting on the tables. But when I type your original answer the same message is shown. Regarding ? Format(Date(),"yyyymmdd" It dont get anything ;( when I write that in VBA window
That makes no sense, did you get an error ? (Your quoted text is missing the closing quote " so as typed you would have got an error message)
The immediate window is shown by pressing control + g in th vba editor.
As to your original code this should work,
I've just tried it on a similar layout based on columns in a list box (column 2 is a date field) , and a formatted check box;Code:=Format([fecha_entDT],"yyyymmdd") & "-" & [CODIGO_planta] & "-" & [id_item]and this gives meCode:=Format([lstDBList].[column](2),"yyyymmdd") & "-" & [lstDBList] & "-" & Format([chkUnlockList],"Yes/No")
20190320-15-Yes
In the text box.
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
Pfffff... Okay, I found out the problem... My access program is in spanish so year = año... So, Finally I got it.... Oh my lord...
It is a little bit different, but it works for my case: =Format([fecha_entDT];"aaaammdd") & "-" & [CODIGO_planta] & "-" & [id_item]
And it shows what I want from the beggining. Thank you so much for your patience Minty...
One more thing, How do I copy the value that I obtain from this textbox called "txtCodigoRFQtxt" into my field "CodigoRFQ" which is in the same form, instead of copying it manually?
Thank you so much!
Last edited by mar7632; 03-20-2019 at 06:28 AM. Reason: Spelling
Glad you have it sorted out - I was beginning to wonder if it was a language issue (I'll try and remember that in future!)
As for storing this value, personally as already stated I wouldn't.
You can always create it from already stored information and therefore storing it leads to issues if any of the underlying values are changed anywhere in your system, you have to capture that and update this value. It's not a recommended practice.
If you must then simply use the afterupdate event of one (or all) of textboxes that hold the constituent parts, and set the control to the same value.
As you can see you already need to capture this two or three times, whereas a calculated value remains accurate at all times.
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
One more question,
In a number field, how do I display after a number is introduced in a form a text like "weeks"
For example: 5 weeks
Can use a label control with caption set to "weeks".
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Could you provide me a example, please?
or you can use the format property for the control e.g. put this in the format property
0" weeks"
Thank you Ajax!