Modules & VBA :: Using Contents Of MS Access Table?
Feb 14, 2014
I would like to ask if it is possible to use the contents of a table as a comparator? For example, I have this column in my table that has the schedules of the professor, if the professor for example failed to login within fifteen minutes after his/her supposed start of class a message will be displayed on the screen notifying that the professor has not yet logged in.
I would like to open an Excel workbook from MS Access and clear cell contents, or just delete some records in a specific worksheet.
If you open the test workbook, cell contents in RAW need to be deleted by calling from Access.
I have produced some code but it's partially working.
Code: Sub TestFileOpened() ' Test to see if the file is open. If IsFileOpen("test.xls") Then ' Display a message stating the file in use. MsgBox "File already in use!"
[Code] ....
If you put this in a standard module in access, the function works, but the part that doesn't work is where it says "activesheet". It somehow tries to recognize it as a variable, but it's not going to be a variable.
I am very new to access less than 1 week since i started trying to build an horse racing database, i am trying to link data from 2 different sources via the horses name however one source displays this with the horses country of origin in parenthesis foe example FRANKEL(GB) and the other source displays the name as just FRANKEL, to be honest i haven't yet tried the link but guess it will fail.
I am therefore looking to get rid of the parentheses and their contents from an access table field and create another field without them.
In Excel i use the formula B1:
=TRIM(REPLACE(A1,FIND("(",A1&"("),FIND(")",A1&")")-(FIND("(",A1&"(")-1),"")) and that works fine.
I guessed the solution for Access would be newname:
I am trying create some code that checks if the contents of the status field in a table is "Authorised" where the ID = something specific for multiple records. If all records witht the specific ID are "Authorised" Then generate a new record in another table. Where to start, perhaps a Dlookup?
Me.TxtNotAllowed.Visible = True dtTimer1 = Now dtTimer2 = Now + TimeValue("00:00:10") Me.TxtNotAllowed.Value = "You do not have permission to use this database !" Do Until dtTimer1 >= dtTimer2 dtTimer1 = Now() Loop Me.TxtNotAllowed.Value = "" DoCmd.Quit
The above code will run definitely for the 10 seconds however the textbox and contents do not display HOWEVER if stepped through with breakpoints line by line and the form checked each time the textbox DOES display and its contents.
sorry for the title. i didnt know what to write. this is the situation:
i have a form where it populates a table in access (ssmdata) from an oracle table w_ssm_data). this works perfectly.
Then the form read the hole new table in access (ssmdata) to update a specific field.
Problem: If i open the access table (ssmdata) it is sorted by the flight fields. However, when the form reads the table in order to update the specific field the table seems to not to be sorted by the flight field.
More info: The ssmdata table in access has many primary keys (flight, departure,arrival,caterer,frequency and aircraft).
If i take a look to the W_ssm_data table in oracle it is not sorted by flight and it is sorted in the same way the form is reading the ssmdata table in access.
example: table in access: flight dep arr caterer aircraft frequency 1 a b a 111 67 1 a b a 222 134 2 c s c 111 5
table in oracle: flight dep arr caterer aircraft frequency 2 c s c 111 5 1 a b a 111 67 65 t h t 252 1
when the update step starts it reads the access table as it looks in oracle. but if i open the table in access it looks sorted by flight.
I've got some code that loops through a record and copies the non-null fields to another record. This is the partial code:
For Each fld In tdf.Fields If Not IsNull(Forms!contact_lookup![Contact_sub subform1].Form(fld.NAME)) Then strSql = "UPDATE tbl1 SET tbl1.[" & fld.NAME & "] = '" & Forms!contact_lookup![Contact_sub subform1].Form(fld.NAME) & "' " & _ "WHERE tbl1.[FC_APN] = '" & Me.txtApn & "';" DoCmd.RunSQL strSql End If Next fld
This works fine until it encounters a field whose contents has a reserved character, like a single quote (" ' ") in it, for example, "What's the what." At that point the SQL thinks there's a " ' " missing in the statement, and I get an error 3075 (syntax error: missing operator).
Basically i'm trying to link Access to Outlook to retrieve emails , When using the wizard to link outlook folder to Access it fails, i've been informed that this is due to the version of Access they have installed which is a ThinApplication.
i was wondering would it be possible to access / link my outlook emails to access via VBA Coding?
All i need is the raw contents of the email and subject.
Hi, I am trying to copy the contents of a table with 11 fields into a new table which is the same except for an additional two fields at the end. Any advice would be appreciated.. Thanks..
Any way in MS Access to read the TOC data from an Audio CD? It is I believe in the lead-in part. I have a music database, and would like to be able to read the track data directly from the CD (Title, artist, timing), without having to type it all in again.
I know this can be done, because my CD labelling software extract the data automatically - but can Access do it?
I have some code to create a table of contents/index for a report which has "chapters" which can be added or dropped depending on whether we choose to stock something or not. And I'm getting the strangest issue. The very first "chapter" starts fine on Page 1. But the next item we sell (Chap 2), then starts on Page 3, instead of Page 2. Here's what's strange. Every other item is then one page off. Below is my code.
Code: Option Compare Database Dim db As Database Dim TocTable As Recordset Dim intPageCounter As Integer Function InitToc() 'Called from the OnOpen property of the report.
[Code] ....
The InitToc fx is called upon the opening of the pricebook, the UpdateToc fx is called upon printing. There's something in here where I think I'm calling the functions incorrectly, but I'm not sure quite what the error is.
This may seem a very simple question, but I really don't know how to do it. Basically, I want to MessageBox contents of a table with a button. I have a table called Map, and has two fiels: Column Number and Description. When a button is pressed, then I want a messagebox to come up and show the column number and the description of a single field. Although I know it is very wrong, here is the code I used for this (r![column Number] = 4 is meant to be the forth column number in the table):
Dim d As Database Set d = CurrentDb Dim r As Recordset Set r = d.OpenRecordset("Map")
I am creating a report which is about 200 pages and would like to add a table of contents for each category i have with page numbers, however i have googled and tried many different things but to no avail and what it the correct way or even showing me on a sample database.
I am new to VBA and I am looking for some code to use in access 2007 where I can cut the entire contents of a folder on my C: drive and paste it in a separate folder in my C: Drive
I have a subform in Continuous Records format (records displayed are determined by controls on the parent). I would like to create a button that prepares an email and copies the contents of that subform in to the body of an email message.
The email. I have a method to create a new email, set To, CC, Subject and even Message Text.
Code: strTo = txtName strCC = txtManager strSubject = "Something" strMessage = "Hi, please find below list of details from X Y and Z" & vbnewline & vbnewline
That all works. Thats fine
The Records: I have found ways to have them added as an attachment, either the the SendObject and OutputTo method but I would like the list of records to be converted to a text string so I can include it within my strMessage variable, not include it as an attachment.
Code: strMessage = strMessage & "Subform Records to go here"...
I have a field called "Bad Pc Part" which is a listbox. THe problem is I want it to display the contents of 3 other fields from another table.
I created a query for the Bad Pc Part field but the problem is it only displays the information in the first field of the table. It doesnt show the contents of the other columns. I need it to do this.
I have a combo box containing "ProgramType". If "DDI" is selected from this combo box, I would like it to open up another combo box containing the contents from "tblDDI". Then I would like the selection to be transferred to "ProgramType". Is this possible?
I am developing a form whereby the user types a single character or a sequence of characters into textbox and a query WHERE clause is compiled upon each character being entered.
The query is the Row Source of a listbox which I requery upon each change in the text box contents.
In the Change event I cannot access the new contents of the textbox until focus moves to another control and then back to the textbox. This is not how I expect this event to work.
I have a parameter that I need to get a table contents between dates. In the query:
Birthdate: XXTable: criteria as follows: Between [Enter Start Date] and [Enter End Date:]
When run it gives me the Error - ! This expression is type incorrectly, or its too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables
I have tried almost everything. The formatting of the Birthdate is x/x/xxxx or shortdate. Will this affect the input thus affecting the outcome of the query.
I have fairly large table called QBInvoices that consist two fields- qbinv and date . Also, I have a report that showing info off query called TotalQueryQB. The table and query have no relations except dates . I need to show on report filed qbinv off table QBInvocies on the top of the reprot based on date. The user type date on form -frmQB text box txt Date and I would like to have contest of field qbinv off table QBInvocies on the top of the report base on date that was typed.
I have a situation where I have a report which I will generate to print our companies pricebook. I need an index/table of contents for customers to go to the page where a product is to look up prices. The problem is that we add and subtract products on a consistent basis.
So a new product will get added, but of course, to run alphabetically, there's no way to insert it, then renumber the pages for it to be easily found.to use a maketable query, which sorts all of the products alphabetically. Each time it is run, it will delete the previous table. I then need to have an autonumber field created to create my "page numbers". Yes, each time the pricebook is run, products can and will oftentimes get new page numbers.
So my thought is to have a macro run which creates the autonumber field to the table. This will then be the basis for the form, which will in turn utilize the "page number"/autonumber field to both serve as page numbers in the report. And of course, the table which is created each time will be the "table of contents".