Modules & VBA :: Extracting A Field From Recordset?

Nov 11, 2014

Is there a possibility to use a shorter code for extracting one field from one record, than opening a recordset, getting the field, closing it and setting the recset to "Nothing" again? I'm doing this multiple times in my code and it seems a bit too much for what it's supposed to do.

Code:
sql = "SELECT tblAdFlgDaten.* FROM tblAdFlgDaten WHERE (((tblAdFlgDaten.AuftrID)=" & ABAuftrID & _
") And ((tblAdFlgDaten.Schritt)=2))"
Set RSnap = dbase.OpenRecordset(sql, dbOpenSnapshot)
If IsNull(RSnap.Fields(2)) Then
...
...
End If
RSnap.Close
Set RSnap = Nothing

View Replies


ADVERTISEMENT

Modules & VBA :: Retrieve Field Properties DAO Recordset

Jan 25, 2014

Is it possible to retrieve the format of a field when looping through recordset.

e.g you can get the field type by using

Quote:

rs.Fields(y).Type

But the type for decimal or percentage is the same. It is the format that is different

I need to be able to see what is formatted as a percentage and what is formatted as fixed.

View 7 Replies View Related

Modules & VBA :: Referring To Calculated Field In A Recordset

Nov 22, 2014

I am trying to use a calculated field in a recordset but I am having problem with the script trying to compile.

my record set is

Set rstPrice = db.OpenRecordset("SELECT Period_desc, Price, Round(Price/7,2) AS Daily_rate FROM qryPropertyPriceList WHERE [Our ref] = '" & rstProp![Our Ref] & "' And [Year] = " & rstProp![Next year price base] & " Order By Sequence", dbOpenSnapshot)

The calculated filed I have added in is Round(Price/7,2) AS Daily_rate

If I let it run just with this it runs fine.

and then I try to use this calculated field:

Do Until rstPrice.EOF
Temp = Temp & rstHTML!html35 & rstPrice!Period_desc & rstHTML!html36 & rstPrice![Price] & "-" & rstPrice![Daily_rate] & rstHTML!html37
rstPrice.MoveNext
Loop
rstPrice.Close ' Tidy up
Set rstPrice = Nothing

They it stops running and it all seems to be because of the Daily_rate field

View 11 Replies View Related

Modules & VBA :: Variables As Field Names In Recordset

Mar 12, 2014

I am using Access 2013 under Windows 7. In my database I have a table, tblStock, with field names Module, Component_1, Component_2, etc. up to Component_50. I also have fields Qty_1, Qty_2, etc. up to Qty_50. These field names are not easily changed as they are constantly updated from another database. I want to create a table, tblTempBOM, using VBA by selecting a particular value of Module selected from a combo box on a form, from tblStock and creating a record with the Fields "Module", "Component" and "Qty" for each Component and Qty from 1 to 50. I am trying to use a From... Next... loop to cycle through the Component and Qty fields and store the data in the new table.

Dim strModule As String
Dim strSQL As String
Dim strQty As String
Dim strEye As String
Dim strTest As String

[code]....

This runs to the point where I try to set the value of rcd![StockCode], but the item rcdStock![strTest] has no value.Can I reference the value of the field in the rcdStock Recordset in some other way that would work?

View 5 Replies View Related

Modules & VBA :: Edit Recordset Querydef That Has Calculated Field

Jan 19, 2014

Is it possible to add/edit a record from a DAO querydef that has a calculated field in.

Code:

Set qdf = db.QueryDefs("qryOutput_" & strDept)
qdf.Parameters("Enter Date") = dDate
Set rs = qdf.OpenRecordset()

Using the rs.Edit or rs.AddNew worked fine until I put a calculated field in the query.

The calculated field is just a total of some fields in the table.

I thought this was something to do with dbOpenDynaset but it just keeps having the same error

Cannot update. Database or object is read-only.

View 3 Replies View Related

Modules & VBA :: How To Check If Field Value Exists Using Open Recordset

Nov 25, 2014

I am storing values of pictures and the location of them in a table, this works fine!... using OpenRecordset. The problem is that when the function is called to store the information, it just keeps adding the same values of each file in the folder over and over again in a word "Duplicating" the information.

I have tried various methods using the OpenRecordset, but cannot seem to find the correct manor of applying the code.

Below is the function I have for storing the data...

Code:
Public Sub GetFilesNamesFromFolder(strFolderPath As String)
On Error GoTo ErrorHandler
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.folder
Dim objFile As Scripting.File

[Code] .....

View 12 Replies View Related

Modules & VBA :: How To Extract Recordset From Subform Into Recordset Object

Aug 14, 2015

Special situation: The SQL Server Linked Server across the country is linked to a Read Only Oracle DB. This data pull works perfectly and populates the Subform.

The problem is that Oracle can take 3 to 6 seconds to retrieve the single record depending on the network traffic through a small pipe.

The code below shows the RecordSource for the SubForm. clicking on a list box supplies the value. Then 3 to 6 seconds later, the subform populates.

The actual Recordset for this Recordsource is needed to conduct Validation on each field. Normally this would be on SQL Server, I might just create a Recordset Oject and run this SQL statement again in 1 milisecond. In this case, it will probably take an additional 3 to 6 seconds. Avoiding another lengthy round-trip to Oracle would be prefered.

Goal: How does one grab, clone, or other wise reference the existing recordset for the SubForm?

Note: Immediate Window - One single field can be returned quickly

There are 48 fields that need validation - is there a way to reference the entire recordset?

Immediate Window during Break Mode:
? me.fsubsrNavSHLBHL("NavSH_QQ")
NESE ' this is the correct value for the current recordsource

Set a breakpoint right after the line:
fsubsrNavSHLBHL.Form.RecordSource = "Select * from vsrNavigatorSHLBHL where Well_ID =" & txtNavWellID.Value

Immediate Window:
? me.fsubsrNavSHLBHL.Form.RecordSource
Select * from vsrNavigatorSHLBHL where Well_ID =91229

View 4 Replies View Related

Modules & VBA :: Extracting Data From PDF Form

Aug 7, 2014

I am trying to extract information from a fillable PDF form that my company has created. Rightfully so, they have completely locked down all options, so I am not able to convert the file in Adobe Reader to a text file. I've seen options to extract information using VBA code with Adobe Acrobat; however, I do not have a license for the program. Is there any VBA code that uses Adobe Reader to extract information and put it in an Access database?

View 9 Replies View Related

Extracting Part Of A Field

Jul 27, 2005

I found a thread from last year that is close to solving this question but not 100% so I'll post this new thread.

I have a field called ITEM_NUM in a database with the following structure:

XX-YYYYYYYYY
XX-YYYYY
XX-YYYYYYYYYYYY

I need to extract the Y portion of the data and a Query format would be the best.

FYI, the X portion consists of 2 Letters/numbers then the Hyphen and the Y portion is variable in length.

thanks for your help!

View 1 Replies View Related

Extracting Data Into A New Field

Dec 13, 2005

You guys have been so helpful in the past. Perhaps you can help me with this as well. I believe it’s a bit out of my scope. I have a list that reads similar to this:

Field 1

DMA: ALBANY
CAR 1
CAR 2
CAR 3
DMA: BOSTON
CAR 1
CAR 3
CAR 4
CAR 5
CAR 6
DMA: HOUSTON
CAR 1
CAR 3
CAR 4
CAR 5

I need it to read like this:

Field 1 Field 2

DMA: ALBANY CAR 1
DMA: ALBANY CAR 2
DMA: ALBANY CAR 3
DMA: BOSTON CAR 1
DMA: BOSTON CAR 3
DMA: BOSTON CAR 4
DMA: BOSTON CAR 5
DMA: BOSTON CAR 6
DMA: HOUSTON CAR 1
DMA: HOUSTON CAR 3
DMA: HOUSTON CAR 4
DMA: HOUSTON CAR 5

If my list was this short, I would do it all manually, but my record list is in the 10,000s. Basically I want field 1 to read: DMA:ALBANY and Field 2 to read:CAR 1, and so on. I’ve tried linking the table to itself in a query, however, that hasn’t proven to be helpful. I've also searched the FAQ's and newsgroups. Any insight would be appreciated.

Thanks,
Amanda

View 3 Replies View Related

Modules & VBA :: Extracting XML Data From Multiple Folders

Jul 1, 2015

I have over 500 folders that contain XML files in each folder. I need to go through each folder and append the data from the XML files into my database.

View 1 Replies View Related

Extracting Data From One Field In A Table To Another--Help!!!

Jun 27, 2006

Hi Guys,

I have a table called "tblEmployees" with the following fields:
EmployeeNo (Primary key)
Name
Address
DOB etc
Letter1Dated
Letter2Dated

I have another couple of tables:

"tblLetter1" with the following fields:
EmployeeNo (Primary key)
Name
Letter1Dated
Letter1RemainingFields...

"tblLetter2" with the following fields:
EmployeeNo (Primary key)
Name
Letter2Dated
Letter2RemainingFields...

I want to be able to put the data from 'Letter1Dated' field (from the "tblLetter1" table) into the 'Letter1Dated' Field in the "tblEmployees" table.
Likewise, I want to be able to put the data from 'Letter2Dated' field (from the "tblLetter2" table) into the 'Letter2Dated' Field in the "tblEmployees" table.

All three tables have the same primary key (EmployeeNo), which makes it even more difficult to do this!
I understand this may sound abit confusing so i apologise for this.

I would really appreciate it if anyone could point me in the right direction please.

Thanks alot.

View 4 Replies View Related

Extracting Data From A Field In A Table.

Jan 29, 2007

when I have created my table I have created a field called name that stored both last and first name. Right now I need to extract the the last name from the the field name and store it in another field "lastName". Any ways to do that?

View 7 Replies View Related

Extracting Numbers From A Memo Field

Mar 15, 2006

Hi all

I have a field on a database thats generally used to enter notes.
Within these are mobile phone numbers in no particular order(throughout the field)

Im not sure what the code is to enter in the query to display only mobile numbers from this notes field ?

Any help will be appreciated

Thanks

View 1 Replies View Related

Modules & VBA :: Can Use Result Of One Recordset For Other Recordset

Jul 7, 2013

I want to write a email where there are 2 or 3 different ordernumbers for same email, i want to include the email in the mail part as single column table. how to do it? also can i use result of one recordset for other recordset?

View 1 Replies View Related

Modules & VBA :: Search Table With Attributes - Extracting HTML Values

Oct 3, 2013

I have a table in msaccess which i would like to use as a search term to search values in another table. What i wanted to do is search the table with attributes and save all found attributes to a new table with its primary id.

Search_Keyword_Table
Id ---- Search_keyword
1 ----- Size - S
2 ----- Size - M
3 ----- Size - L
4 ----- Size - XL

Table to be searched

Id ----- Attributes
1 ----- <select name="attribute" id="attribute"><option value="Size - M">Size - M</option><option value="Size - L">Size - L</option></select>
2 ----- <select name="attribute" id="attribute"><option value="Size - S">Size - S</option><option value="Size - M">Size - M</option><option value="Size - L">Size - L</option></select>

Saved table results
Id ---- Attributes_found
1 ---- Size - M
1 ---- Size - L
2 ---- Size - S
2 ---- Size - M
2 ---- Size - L

View 2 Replies View Related

Trouble Extracting Field From Table Based On 2 Criteria

Jun 30, 2005

Hi all,
Been pulling my hair out about this for a while, so i hope someone's feeling kind:


http://www.agga.dsl.pipex.com/pics/AWF01.gif

I'm using the BHRefPrefix to build part of a reference number. The Principal and Site exist on a separate form, and i need to use both as criteria in order for the correct BHRefPrefix to be returned.

I sort of get it working using two joins, but it doesn't let me add any new records. I've tried straight queries, queries with DLookup expressions, and i just can't get what i need.

Pete

View 3 Replies View Related

Queries :: Extracting Data From List In Separate Field

Sep 19, 2014

695515*97
531924*11
495853*131
377035*181

Is there a way to extract the 97, 11, 131, 181 numbers from the above list in a separate field?

View 1 Replies View Related

Modules & VBA :: EOF Is Not Being Recognized In Recordset?

Mar 18, 2014

I have a form with a query set up as the record source. If there are records in this query, the form will display. When the user clicks a button, if there is another record in this query, the form displays the next record. When it gets to the EOF, it should close this form, but EOF is not being recognized (I run debug and it says it's false when the button is clicked)? I get run-time error '3201' after I click the button twice.

I know for a fact that there are 2 records in this query. So once I click the button on the 2nd record, the form should close.

Code:
Private Sub SelectTblMyMedButton_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("qryMedDataSelect", dbOpenDynaset)

[Code] .....

View 3 Replies View Related

Modules & VBA :: Looping Through A Recordset

Jul 8, 2014

I have learned the basic looping technique for going through a record set from the following link. I need to know if my logic is on the right track. URL...

My question is a followup to a thread that was opened on this forum: URL....I want to do the following:

1) Use record set looping technique to fix a variety of incorrect naming conventions to a standard format
2) Update the table (or create a new table) from the updated record set values. (Is my logic going to update the table selected in the code I used to dimension the record set or will I need to do something else to make the changes available for other tasks after record set is closed ? After the naming conventions are fixed this data will be available for excel automation that I am working on and posting questions on another thread in this forum. HAHA I'm going code BANANAS)
3) rs.fields![fleetlocation] is used so many times, how can I make this a variable (what do I dimension the variable as?)
4) Use an AND statment with an if statment (how to do this with correct syntax)

Code:
sub loopandfix()
on error goto errorhandler:
strSQL = "tblUnionQueryResults" 'table was created from a union query but has inconsistant naming conventions for the fleet location name

[code]....

View 9 Replies View Related

Add New Field To Recordset

Feb 4, 2006

I have a Suppliers table with 3 fields (code,name,addr).
I have a Form where I need to list all records in this table + a checkbox against each record on which the user will tick for only some suppliers he wishes to select.
How can I do this without this??

I dont want to create a table just for this. Is there a way I can populate these records into a temporary Recordset & Add a field to it, and then assign this recordset to the Form???

:confused:

View 1 Replies View Related

Modules & VBA :: Cannot Instantiate Child Recordset

Jun 17, 2013

I am trying to open a child recordset but keep getting Error 424 "Object required".

Dim rstEmails As DAO.Recordset2, DBS As DAO.Database, rstFile As DAO.Recordset2
Set DBS = CurrentDb
Set rstEmails = DBS.OpenRecordset("Beldenemails")
Set rstFile = rstEmails.Fields("email").Value 'Error 424 here
End Sub

I've tried everything I can think of.

View 4 Replies View Related

Modules & VBA :: Loop Through SubForm RecordSet?

Jun 4, 2014

Is there a way of looping through a non update able continuous subform, and using information from each line.

Which creates a new record in another table? so if there are 3 records in the subform it creates 3 new records in the other table and so on?

View 3 Replies View Related

Modules & VBA :: How To Remove ADO RecordSet From ListBox

Aug 6, 2013

How does one go about removing a recordset from a ListBox?

I have a list box that I want to toggle between using a query and an ADO RecordSet to populate the values.

Once I set the listbox .RecordSet property to the ADO.Recordset, I can't remove the values displayed in the listbox when I assign a query to the .RowSource property.

I suppose I can turn the .RowSource query to an ADO Query but I am being lazy and don't want to rewrite the query as a T-SQL query.

I previously thought the list box was pulling data from the .RowSource query but I realize I was wrong.

View 1 Replies View Related

Modules & VBA :: Create Recordset From List Box

Sep 3, 2014

Is it possible to create a record set from a list box?

I have two list boxes list1 (customers) the can transfer records to list2. I want to take all records from list2 and use it to open a report, using customer id as where clause in my docmd.openreport statement.

View 4 Replies View Related

Modules & VBA :: Drop Down List From Recordset

Aug 21, 2013

As I am moving through my code, I'd like there to be a pop-up box which asks the user to choose from a list of dates. This list of dates only resides in a filtered recordset in the background.

Once the date is chosen, then my code continues onward..I know I could make some sort of pop-up form, but I'd rather not have to go in a design all that just for a list of dates...

1) Is there such a thing as a dropdown list on a Input box?

and even if there isn't...

2) Is there a way I can bind the column in a recordset to a dropdown list?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved