473,382 Members | 1,375 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,382 software developers and data experts.

update recordset

158 100+
I'm using 2 forms one is a customer entry form and the second is an invoice entry form for that particular customer. I'm sending the invoice form the customer id number to keep the link up. The form is set as a continuous form and what i am having the user do is press a button to add a new record. For example the customer needs a piece of equipment and the accessory to that equipment. This would be on two lines (records) in the continuous form. The code that i am doing this with works, i just need to "update" or refresh the form to display the new record.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command22_Click()
  2. Dim rsInvoice As ADODB.Recordset
  3. Set rsInvoice = New ADODB.Recordset
  4.  
  5. rsInvoice.Open "tblInvoice", CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdTable
  6.   If (Not (rsInvoice.EOF)) Then
  7.     rsInvoice.MoveLast
  8.   End If
  9.   If (rsInvoice.Supports(adAddNew)) Then
  10.     With rsInvoice
  11.       .AddNew
  12.       .Fields("InvoiceNum") = varInvoiceNumber
  13.       .Fields("FreightCompany") = varFreightCompany
  14.       .Fields("AgentRef") = varAgentRef
  15.       .Fields("ProNumber") = varProNumber
  16.       .Update
  17.     End With
  18.   End If
  19.  
  20. rsInvoice.Close
  21. Set rsInvoice = Nothing
  22.  
  23. Me.Refresh
  24. Me.Repaint
  25. End Sub
Thanks in advance!
Sep 5 '08 #1
2 1998
RuralGuy
375 Expert 256MB
A Requery is needed in order for a RecordSet to pick up or drop any new or deleted records. A Refresh simply updates current records in the RecordSet.
Sep 5 '08 #2
Jollywg
158 100+
A Requery is needed in order for a RecordSet to pick up or drop any new or deleted records. A Refresh simply updates current records in the RecordSet.

You are awesome! thanks bunches!
Sep 5 '08 #3

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

Similar topics

0
by: Sue Adams | last post by:
I actually have two issues/questions: I have an autonumber field in an access db table that I grab and later use to update a record in another table withing the same db. The code I use to get...
2
by: Joseph Markovich | last post by:
I'm having some trouble with VB in Access 2000. I have a form that the user enters in just one number (in this case, it's a base salary) and then the program is going to do a bunch of math (which...
3
by: -Michelle- | last post by:
Hi Using A2003 on XP I am wondering from the MVP's and others, what is the most efficient way (in terms of time to process) of updating data in a table, using the docmd.RunSQL or Recordset ...
3
by: Ken | last post by:
The following code results in a recordset where every other record of tblOne has =True. The recordset count is correct but one record is skipped; exactly half the records are updated to True. Why...
2
by: Nono | last post by:
Hello, I have an Access Database that I want to update using an Excel spreadsheet. When it is new reccords, I know how to do it. Nevertheless when I want to complete the information on a...
5
by: tony010409020622 | last post by:
I just spent 4 months taking a dotnet class where i learned very little. One of the things I did not learn is this: What are the dotnet equivilents of commands such as: Adodc1.Recordset.AddNew...
2
by: DaveN | last post by:
Hi all, I'm trying to update a record in a table with data from text boxes on a form. As a background to this, I managed to add a new record to the table in a similar manner with the following:...
1
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta...
1
by: sphinney | last post by:
All, I have a ADODB.Recordset in my Access 2002 project. I've been able to successfully add fields to the record set. According the the MS Access help files, I now must update the recordset to...
2
by: Presto | last post by:
I am making a front end mdb so users can enter new members data. I can then import this into the master database on the backend and erase the existing info on the front end to keep the data...
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...
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
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.