Hello there
I am a newbie in access and i ve been doing some forms for our company's work. I ve come across a problem which is a bit wierd i guess.
I dont know if i have to tell every detail but i ll try.
I have a combox in my form which gets its data from another tabel, and i got 2 textboxes that is updated when the combobox's value is updated.
First textbox(lets say textbox1) has a control source Is_Number which is incremented +1 everytime new record is set.
And default value is set to :
DLookUp("Max(
![Is_Number])+1";"AAA")
Textbox1 works perfectly. Everytime new record is entered new record has a new value which is max value +1(I didnt get ID autonumber here because ID is incremented by 1 even record is deleted or dropped when editing the form)
But 2nd textbox is problematic(textbox2). I need textbox2 to count each combobox's selection and bring me the number. I ve done this using a query and textbox's control source is this dlookup function
=DLookUp("Report_No_C";"Report_no";[Calc_field1])
This works fine and brings the query's result.
When i change the combobox's selection, textbox2's value is changed accordingly. But data is not entered anywhere. So i changed the control source to "Report_no" field in AAA table.
And i placed the dlookup function to default value of textbox2.
But this seems not working. Even data is not showing when form is opened
My question is: How can dlookup work with a table field but not with a query field.
or Is there another way to add query's result into table field while working with forms
Thank you in advance
I am a newbie in access and i ve been doing some forms for our company's work. I ve come across a problem which is a bit wierd i guess.
I dont know if i have to tell every detail but i ll try.
I have a combox in my form which gets its data from another tabel, and i got 2 textboxes that is updated when the combobox's value is updated.
First textbox(lets say textbox1) has a control source Is_Number which is incremented +1 everytime new record is set.
And default value is set to :
DLookUp("Max(
Textbox1 works perfectly. Everytime new record is entered new record has a new value which is max value +1(I didnt get ID autonumber here because ID is incremented by 1 even record is deleted or dropped when editing the form)
But 2nd textbox is problematic(textbox2). I need textbox2 to count each combobox's selection and bring me the number. I ve done this using a query and textbox's control source is this dlookup function
=DLookUp("Report_No_C";"Report_no";[Calc_field1])
This works fine and brings the query's result.
When i change the combobox's selection, textbox2's value is changed accordingly. But data is not entered anywhere. So i changed the control source to "Report_no" field in AAA table.
And i placed the dlookup function to default value of textbox2.
But this seems not working. Even data is not showing when form is opened
My question is: How can dlookup work with a table field but not with a query field.
or Is there another way to add query's result into table field while working with forms
Thank you in advance
Last edited: