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

ADO recordsets and Queries

HI

Is there any way while having a data entry form open and using "After Update" to use ADO to open a query that runs the data on the still incomplete open recordset of the form.

rst.MoveLast brings me to the last completed line of data entry, but I want to access the line still being entered.

I can see several work arounds here but I wonder if there is a better way.

Thank You
Ivan
Sep 5 '06 #1
5 2001
PEB
1,418 Expert 1GB
Have you tested recordsetclone?

See Access help for more info about RecordsetClone! :)
Sep 8 '06 #2
Hi

Using recordsetclone didn't help.

In ADO after .MoveLast using:

Me![Something] = rst![somethingelse] returns the last value written to the table.

Me![Something] = [somethingelse] returns the value currently in the form but not yet written to the table.

The problem, I think, is that the sql in the query is based on the TABLE relationships such as the joins. When I run the query based on data already written to the table it works fine. But it does not run based on the data only in the form and not yet written to the table. I am not sure if I can get this to work.

Maybe a query-by-form would be better, though I haven't tried this yet.

Is there a better solution without haveing to close out my current form first?

Thanks
Ivan
Sep 9 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
If you could tell us exactly what you are trying to do in the AfterUpdate event you may not need a recordset at all.



Hi

Using recordsetclone didn't help.

In ADO after .MoveLast using:

Me![Something] = rst![somethingelse] returns the last value written to the table.

Me![Something] = [somethingelse] returns the value currently in the form but not yet written to the table.

The problem, I think, is that the sql in the query is based on the TABLE relationships such as the joins. When I run the query based on data already written to the table it works fine. But it does not run based on the data only in the form and not yet written to the table. I am not sure if I can get this to work.

Maybe a query-by-form would be better, though I haven't tried this yet.

Is there a better solution without haveing to close out my current form first?

Thanks
Ivan
Sep 10 '06 #4
PEB
1,418 Expert 1GB
Hi Ivan,

It seems that you want to go programatically in your Table to record that is the current record in the Form doesn't you?

So is in your Form the respective ID of the record that is primary key or unique value?

IF Yes, on after Update you have to put:

Expand|Select|Wrap|Line Numbers
  1. Dim Mydb AS DataBase
  2. Dim Myr AS recordset
  3. Set mydb=currentDb()
  4. Me.Refresh 'To save the introduced info
  5. Set myr=mydb.openrecordset("SELECT [Your needed Field] FROM [Your needed table] WHERE [Table ID]=" & STR(Your_ID))
  6. IF myr.recordcount=0 then exit function
  7. myr.movefirst
  8. ..........
  9.  
  10. myr.close
  11. mydb.close
  12.  
  13.  
Hope this helps!


:)
Sep 10 '06 #5
Hi
I am close, but not quite there yet so let me explain what I am trying to do.

I am trying to create a form where the first 5 fields are user entered and the last 2 fields are calculated while the form is still up - before the user enters the next line of data.

After the last field the user enters I want to use "After Update" to call a query. This query needs to make use of the just entered data and also data previosly entered in three other tables. This query will return an ID Key value from one of the tables(essentailly a lookup table) and then a module will use this value from the query and some of the data from the fields just entered in the open form to calculate the information for the last 2 fields of the open form.

When I do my query and module seperate from the data entry form and all information is already written to the tables I get the results I want. Implementing this "on the fly" query before my data is written to the tables is giving me the problems.

My initial thought was to use a recordset and .AddNew to force the data to be written to the table but I didn't get that to work. However, in the recordset I can use the data just entered into the form and not yet written to the table, but my query doesn't join on the data from the recordset. It joins on the data from the last line in the underlying form and I haven't gotten it to join to the data in the recordset.

If I give up on the idea of doing this from an open form I can make this work, but I kindof like this set up.

Any suggestions you have would be greatly appreciated.

Thanks
Ivan
Sep 10 '06 #6

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

Similar topics

4
by: Marco Alting | last post by:
Is it possible to INNER JOIN two recordsets in ASP? I don't mean the normal JOIN you would use with two tables, but actually join the recordsets in ASP?
2
by: Pieter Linden | last post by:
The answer to this one is probably "test it yourself and find out!", but I'll ask anyway. Pursuant to my previous question - sending separate recordsets to Word using the CreateTableFromRecordset...
5
by: AFN | last post by:
Hi. I'm pretty comfortable binding a single recordset result to a datagrid. But now I have a more unique problem. I have 2 really long stored procedures that cannot be combined at the SQL...
2
by: Sky | last post by:
Basically, I'm stumped on how to translate something I wrote in PHP to ASP.NET, and I'm having a hard time figuring out what is right way to do it now... The scenario in PHP was as follows: I...
16
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and...
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
24
by: Donald Grove | last post by:
I want to populate an array with values from an ado recordset (multiple rows) I use the absolute position of the cursor in the recordset to define the row of my array to be populated. I have a...
3
by: wgblackmon | last post by:
I'm currently running the following statement that is used in a Crystal Report. Basically, a record is returned when the T_PAYMENT.amount has a record in the database based on the value of the...
2
ADezii
by: ADezii | last post by:
Create Indexes on all Columns used in 'ad hoc' Query Joins, restrictions, and sorts (Jet already creates Indexes for Enforced Relationships). Use Primary Keys instead of Unique Indexes wherever...
1
by: LL-JK | last post by:
Hi Guys, Hopefully you will understand my problem. I have a spreadsheet that i import into a table which contains job data. Using a number of queries i can filter the data as requested. What...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.