473,463 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

first record not add

In Visual Basic i create code to add record that to auto increcment so following code


sql = "select max(job_order_no) as job_order_no from job_order"
Set rs1 = conn.Execute(sql)

If rs1("job_order_no") = null Then
rs1("job_order_no") = 1
Else
Text1.Text = rs1("job_order_no") + 1

End If

when i run and click add button it gives error
Invalid use of null

and when i add one record in access database it work propery but
it gives error when 1st record insert

why it gives error please tell what is problem
Oct 8 '07 #1
1 1102
jrtox
89
In Visual Basic i create code to add record that to auto increcment so following code


sql = "select max(job_order_no) as job_order_no from job_order"
Set rs1 = conn.Execute(sql)

If rs1("job_order_no") = null Then
rs1("job_order_no") = 1
Else
Text1.Text = rs1("job_order_no") + 1

End If

when i run and click add button it gives error
Invalid use of null

and when i add one record in access database it work propery but
it gives error when 1st record insert

why it gives error please tell what is problem

Expand|Select|Wrap|Line Numbers
  1. If rs1.RecordCount=0 Then
  2.         rs1.Addnew
  3.         rs1("job_order_no") = 1 ' Add data also for  the other field. 
  4.         rs1.Update
  5. Else
  6.         Text1.Text = rs1("job_order_no") + 1
  7. End If
  8.  
  9.  
Try this One

Regards
Ervin
Oct 8 '07 #2

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

Similar topics

17
by: Rick | last post by:
Hi all, Is there a MySQL function to get the first record through a query? I would like to open a page of client records with the first one shown. The other records can be accessed from a...
1
by: Richard C Buchanan | last post by:
I have a table as follows: - user_id (key) - user_email_address (text) - user_request_date (text) - user_sent_date (time/date) An automated macro...
4
by: KJ | last post by:
We use a third party software package for acctg that limits us on field size - as a result, we at times have to enter an item into the app multiple times in order to get all the information. I...
3
by: Jason A. Thompson | last post by:
Dear Access Gurus, I have a database which I hoped to use to administer questionnaires, or rather that someone who knows nothing about Access could use to administer them. Each q'aire item is on...
6
by: neptune | last post by:
I must be missing something obvious. I have 3 fields and sample data. 7890 26592 7/15/2003 7890 13645 10/6/1999 7890 58741 6/21/1992 I...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
10
by: Lyn | last post by:
I have a form set to Single Form mode with which I can cycle through the records in a table via Next and Previous buttons. To avoid users pressing the Previous button on the first record and the...
1
by: Karthiga1984 | last post by:
Hi Table Structure company name Phone No Products Example Company Name Phone No Products
1
by: Hubert Wisniewski | last post by:
Hi, I have a problem with first record in my table. I put the data to the table and it's ok, but if I add second row to the table the first record is updated (and has the same value as the...
2
by: ofuuzo1 | last post by:
Hei, I have the following xml file and I have tried to write xslt to extract only the values of the first "record" node. It does not work. I need some help. I used ---- to represent indent. ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.