473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Form unbound text box update with query

5
I have a query to add a record to table which is fine. What I am trying to accomplish is to one
1>Find the highest value assigned to the part # in the same table. This was done with another extra query.
a.QryMaxAGL
Expand|Select|Wrap|Line Numbers
  1. SELECT Max([TAGLserial].[AGLID]) AS AGLmax FROM TAGLserial;
2> Create a text box (unbound) in the form that show the value of the AGLmax + 1
3> Assign this value to one of the field in the table when the user add a new record.
In summary, I have used the following, but I can’t get it to work.
Expand|Select|Wrap|Line Numbers
  1.     Me.text101=  SELECT Max([TAGLserial].[AGLID]) AS AGLmax FROM TAGLserial;
Property sheet,
control source = SELECT Max([TAGLserial].[AGLID]) AS AGLmax FROM TAGLserial;
Any comment would be greatly appreciated.
Jul 4 '14 #1
4 4764
twinnyfo
3,653 Expert Mod 2GB
First, please use code tags when you post code.

Second, your text box should be bound to your table, to make it easier to tie directly into that table.

Third, to set the value of a text box, you cannot use a SELECT statement, but you can use the value from that query. To assign the value of the next ID, try this:

Expand|Select|Wrap|Line Numbers
  1. Me.txt101 = DLookup("[AGLID]", "QryMaxAGL") + 1
Since you are only pulling one record in your query, this should work.

There may be better ways to do what you are doing, but if you want to generate your own IDs, this is one way to do it.
Jul 4 '14 #2
pbabin
5
I really appreciated your help. I don't want to admit the hours reading and trying. It worked like a charm.
Thanks.
What do you mean?
"First, please use code tags when you post code. "
Thanks
I am new to this, and appreciate all recommendations.
Jul 4 '14 #3
NeoPa
32,556 Expert Mod 16PB
Pbabin:
What do you mean?
"First, please use code tags when you post code."
When posting code (of any variety) it is important to use [code] tags so that the code can be viewed more easily and clearly. This is a rule of the site that new members often need to be reminded of. As an illustration I've updated your first post.

Without the tags it's very hard to see the code that you post in any sort of context. When posting your comments the [code] tags button is always available.
Jul 4 '14 #4
pbabin
5
Understood and will do.!
Thanks again for your time.
Jul 5 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: deko | last post by:
I have an unbound text box on a form that is set to: Format = Short Date (with the corresponding input mask) When I run this: DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " &...
4
by: N. Graves | last post by:
Hello, Please help me I'm still a newbie. I have an unbound text box on a report that I would like to build a expression to display it on the report. Something like txtboxSearchCriteria = !!...
4
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
2
by: Zlatko Matiæ | last post by:
Hello. I have the following problem with MS Access/PostgreSQL combination: There is a form in Access that has an unbound text box, used for entering a commentary of a batch of records. There is a...
1
by: hmlarson | last post by:
I have a form/table with checkboxes that I would like the user to check / uncheck if they want a certain record to display in a gallery on a website. I'm having problems figuring out how to...
7
kcdoell
by: kcdoell | last post by:
Hello: I have a continous form that displays various forecasting records that an End user can add or edit the records (this feeds off of a query that I created called "ReQryForecast"). On that...
11
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting a person on that project and clicking on a command...
7
by: HSXWillH | last post by:
I am designing an inventory system and am stuck on a potential problem. I have a table of Stock_Catalog containing the following fields: Stock_ID (random autonumber), Full_Desc, Serial, Auto,...
3
Seth Schrock
by: Seth Schrock | last post by:
I've got an update query that updates all selected records with the value in an unbound form. I have it set so that it retains the value already in the field and adds the new information with a ", "...
1
by: Tracy B | last post by:
I am trying to create a form where the end user will be able to enter a primary key (LN) and bring up the record in my table (MTable). If the record doesn’t exist, I want it to copy that record from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.