473,326 Members | 2,148 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,326 software developers and data experts.

select a number from a form, add 1 and write it in a Field on the form

I have a problem with a Select statement.
I want to select a colom (only a number) from a Table, when I start a form
and add 1 to the number and write the result in a Field on the form.
And than, i want to save it in the same Table and colom!

My select statement is usually like this:

SELECT Max([thenumer])+1 AS numer FROM mytable;

But it dosent woks :(
I cant write VB code. I am looking for a way to solve my problem without
VB code.

Thanks, Amir
Nov 13 '05 #1
1 1190
amir wrote:
I have a problem with a Select statement.
I want to select a colom (only a number) from a Table, when I start a form
and add 1 to the number and write the result in a Field on the form.
And than, i want to save it in the same Table and colom!

My select statement is usually like this:

SELECT Max([thenumer])+1 AS numer FROM mytable;

But it dosent woks :(
I cant write VB code. I am looking for a way to solve my problem without
VB code.


That's a bit like trying to service your car without a socket set or
screwdriver, you can top up all the fluids but you want to gap the spark
plugs.

Using VBA you'd do something like:

Sub Form_BeforeInsert(Cancel As Integer)
Me!MyNum = Nz(DMax("MyNum","MyTable")+1,1)
End Sub

Just replace column and table names to suit. If you find an easier way
without VBA then let us know.

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
3
by: yb | last post by:
I have a unbound mult-select listbox field named "Locations".Multi-select option is set to "Extended". I'm having problem saving the values from this field into table. I have text column...
11
by: pmarisole | last post by:
I am trying to use the vbscript "split" function on a multi-select field. I am trying to do a mass update of several records at a time. I am getting an error and I'm not sure what to do. Here is...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
2
by: printline | last post by:
Hi all I have a problem with a form script. The form script should do the following: When a user selects a value from a drop down list and hits the "next" button it should take him to a...
3
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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: 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...

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.