Modules & VBA :: Get Open Args To Work While Opening A New Form
Jun 25, 2013I have tried a few times to get open args to work while opening a new form.I never could get it to work.
View RepliesI have tried a few times to get open args to work while opening a new form.I never could get it to work.
View RepliesWindows 7
Access 2013
I've been trying to work up a where clause that is generated by a button click event on a report. The workflow that i'm trying to obtain is as follows:
1) A report is run to determine the remaining work orders that need to be processed.
2) A button that is placed on that report is to be clicked, taking the user to the form associated with that work order, so it can be processed.
What i've been able to do so far is capture the unique ID for the work order and then print that in a message box. I can then open the form.
What i haven't been able to accomplish thus far is to open the form to the correct work order.
Things I've tried : I started trying to use the macro with the search for record option and using the where clause. Not successful. I am a little more comfortable in using vba so i switched to that pretty quickly.
Code:
Private Sub btnJobEntry_Click()
'GOAL: open the work order form to the correct entry
'METHOD: store the uniqueID to a variable, then use that in the open command's where clause
Dim strJobID As String
'store the unique ID in the variable
[Code] ....
I've put the strJobID variable in both the filter and where clause sections of the DoCmd but it just opens the form to the first entry. I'm fairly confident i'm not applying the filter/where clause correctly by using the incorrect syntax.
I have a form where a user can press a button, which then prints a report.
The report is basically the same as the form but laid out neater and in a format that fits it to 1 A4 page.
For one of these reports, I would like it to run a different query depending upon which form is used. I know with the forms you can use an open args property but is there a similar way to pass this to a report and have it print immediately?
If so, what's the best method?
Thanks
I am extremely new to writing code, but was able to successfully write code that transfers the data in my form to and excel spreadsheet template and saves it with a different name. The code works perfect and without issue as long as Excel is not running. However if Excel is already open the template remains blank and a warning message appears saying that the form is locked for editing. Below is the code I used.
Private Sub ExcelClear_Click()
Dim xlApp As Excel.Application
Dim xlwrkBk As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = New Excel.Application
[Code] .....
I have a database with a Supply Receipt Form. The first field in the form is a combobox for the user to select a material/supply. I'd like for the form to open to a new record every time. When I use:
DoCmd.GoToRecord , , acNewRec
in the Form On Open property, I lose the ability to select the material/supply. Same thing happens when I set the Data Entry property to Yes.
I've made my database, now I can remember in older access I could make it so when I click the database you would only see the form and not access its self. Is it still possible to do this in access 2010.
View 1 Replies View RelatedI am trying to make my form open directly when i open my access file.accdb. When i double click on my .accdb can it be done to open directly and only my form. I found a way to open my form but it opens the access program in the background.
View 7 Replies View RelatedI have developed a project in Access 2003 and it works absolutely fine. There is a switchboard form too and that works fine as well. But now in our company we are moving all the projects developed in 2003 to 2010. And so I have noticed the switchboard form doesn't work in Access 2010 the way it works in 2003. The Switchboard form doesn't display all the options in 2010.
View 5 Replies View RelatedI started a thread in the VBA section about a problem with a function I'd written. I think it's more to do with how I'm implementing it in a query.
http://www.access-programmers.co.uk/forums/showthread.php?t=139066
Please help.
Is there way a to get this audit trail module to work with a form in Datasheet view? It works fine with a form in Single Form view; I can open the table where the audits are saved and everything looks good. But when implemented on a form in datasheet view, nothing happens. I don't get any errors and nothing is saved to the audit table.
Link : [URL] ....
Here's the vba code:
Sub AuditChanges(IDField As String, UserAction As String)
On Error GoTo AuditChanges_Err
Dim db As DAO.Database
Dim rsT As DAO.Recordset
Dim ctl As Control
Dim datTimeCheck As Date
Dim strUserID As String
[Code] ...
You call it in the BeforeUpdate event like so:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Track all changes made to the record
If Me.NewRecord Then
Call AuditChanges("Asset_ID", "NEW")
Else
Call AuditChanges("Asset_ID", "EDIT")
End If
End Sub
I've got a table with field define as hyperlink which stores link to a external pdf.
Then i create a form including this field and add a unbound field which has got intermet browser format (as a type).
What code I have to put in onclick event in a hyperlink property sheet to open PDF inside the form?
I'm trying to have a form sorted in a particular order when it's opened.
When using the "order by" option in the properties sheet, it is sorted the way I want the first time I open the form.
However, if I change the order afterwards while using the form (for instance, by right clicking and selecting another sort order), well the next time the form is opened, it is sorted with this new sort order, and not the default one.
So I tried to add the following code :
Code:
Private Sub Form_Open()
Me.OrderBy "employee_name ASC"
Me.OrderByOn = True
End Sub
Which failed epically.
I am using Access 2010 and want to open a new form based on an ID from a previous form. Access makes this very easy to do in the macro builder but I am unable to replicate this in VBA afterwards. The reason behind this is I want it to also run some code to export some info to Outlook. I am only filtering the ID from one form to the next. The ID is from a single table.
View 12 Replies View RelatedI have a table that has two forms linked to it - one is the Main Form which is used to input the data for the bulk of entries, however on some entries there will be some additional data required which the other form (lets call it Time Form) takes care of.
What I would like to do is have a button on the Main Form that opens the Time Form, and then go to the specific record that is open on the Main Form;I have an ID field (Autonumber + Primary Key) which displays in a text box on the main form, and it would provide the number of the record for the second form to open.
IThe db has a form called ClientFormNew which logs client details into a table called Clients.Each client has a unique client ID in the table called ClientID. Sometimes Clients call back for further information and we want to log that information into a related table called ClientHistory.Each record in the ClientHistory table has a unique ID called HistoryID which is the same number as the ClientID so these fields are related.
When a client calls back and the telephone adviser opens up the ClientFormNew form and discovers they have called before they need to click on a button called Client History which then opens up the ClientHistoryForm..I am struggling with the code to put on the Client History button as I want the new form to display the details of the clients first contact then allow details of the second contact to be added in a new row. Also the new form needs to show all that client past history which would be in the form of the following fields from the ClientHistory table.HistoryID, ContactDate, Name, ContactMethod, ContactReason, AdviceGiven, Notes.
Hi,
I had copied my MS Access database that I made from work and tried to open it from my home to work. And it said it is only Read_Only. Why is that? Can I change this from my home PC or Can I work with this only from work?
Another thing, then I tried to create another database and I could only do this by creating table from design view and entering data. But I was not able to create it using the table wizard. When I click on the table wizard, nothing happens.
My work's MS Access is 2000 professional version I think, and my home MS Access is 2000l.
Could someone give some advice???
thank you,
Carboncopy
I am trying to program a button on my ms access form to open up an excel file.. So far the simplest code ive found online was from URL....
<code>
Private Sub Command57_Click()
Dim xlTmp As Excel.Application
Set xlTmp = New Excel.Application
xlTmp.Workbooks.Open "C:Excel1.xls"
xlTmp.Visible = True
[code]...
However the code doesn't work, any way to open a file from within access?
I want to that the WHERE clause for a SQL statement that I am using options on a form to build. I intend to use the clause in opening a datasheet form.
This is the code I have for getting the substring
Code:
Dim intPos As Integer
Dim tempString As String
Dim BaseQueryFormStr As String
'BaseQueryFormStr is used to reopen the BaseMasterQueryFrm with the specified parameters
tempString = "WHERE"
intPos = InStr(1, strSQL, tempString, vbTextCompare)
BaseQueryFormStr = Left(strSQL, intPos - 1)
MsgBox (BaseQueryFormStr)
The value of intPos remains=0 and when the program hits the second to last line I get "run-time error 5"
I have the following module in my database to allow for multiple alarms.
It all works great, except before showing the actual alarm record called, the form first pops up showing the first record in its record source.
I.e. it flashes up showing the first record in the table, then changes to the 'correct' record.
I would just like to change it so it either doesn't show until the record is loaded, or it shows blank to begin with.
Here's the module...
Code:
Option Compare Database
Option Explicit
Public clnPopUpAlarm As New Collection 'Instances of frmPopUpAlarm
[Code].....
How I configure my Form Window to pop up as soon as I open my Access Database?
View 3 Replies View Relatedi have a calender of which show's records on date box's i m having a issue when i double click on a datebox it opens a form call update which is filtered on open to show only records for this date but on date boxs on 1st to the 11th i have add the code to do this but when the form open's the form is blank and shows no records but the code works fine for 12th to 31st which i can't understand why? as im using the same code that does dateboxs 12th to 31st on datebox 1st to 11th but doesnt work i'm pulling my hair out on this one !!
View 3 Replies View RelatedI use below simple command line to start a macro in my Access database. Usually all works well. I start my bat file, command is executed and macro does its job.
However it always fails if I have a session of Access already opened even if it is a completely different database. If I use below then it opens another sessions of Access but does not execute the macro. I need to go into the second session and run macro manually. It works fine then.
Code:
"C:UsersMeDocumentsDatabas1.accdb" /X Macro
We are creating a simple database to maintain driver license information for faculty, staff, and students who use cars from the university’s motor pool.
To do this, I have created two tables: tblDRIVER and tblLICENSE.
The fields in tblDRIVER are:
pkfDriverIndex
strLastName
strFirstName
strInitial
strAddress1
strAddress2
strCity
strState
strZIP
datBirthDate
The fields in tblLICENSE are:
pkfUpdateIndex
fkfDriverIndex
datDateUpdated
strState
strLicNumber
datExpirationDate
ynViolations
ynActive
Information about the driver is stored in tblDRIVER and the driver’s license information is stored in tblLICENSE. Periodically, we run a report that identifies drivers whose licenses are due to expire within a certain number of days. All this works fine.
My problem is that I am trying to create a lookup form that will load from a data entry form that will permit the Motor Pool Clerk to look up a driver by name and review the licensing information (which appears as a subform).
All this sort of works- I am using a combo box (based on a query) to look up a driver’s last name (which it does) and to populate all the driver’s information on the look-up form (including license information in a subform). Currently, the combo box locates the driver (including the unique index, last, and first names), and populates the form with first and last name but the rest of the information is not displayed on the look up form. Worse still, sometimes one driver’s last name matches up with the first name of the next driver listed in the table! This seems to happen only if a look up is attempted more than once. What gives.
Thanks for the help.
I have a Form opening from Access Options. I would like to close this Form using the Timer. The following is the code I have used but it is not working.
Private Sub Cover_Page_Form_Load()
OpenTimer = Timer
End Sub
Private Sub Cover_Page_Form_Timer()
If (Timer - OpenTime) = 5 Then DoCmd.Close acForm, "Cover_Page_Form", acSaveYes
End Sub
Next question. If I can get this to work can I then use a DoCmd to open new Form within the code above or do I need a new process.
I am struggling to get the value off of an open form into my current form using VBA. I am trying:
Me.InvoiceNumber = Forms!Invoices!InvoiceNumber
But it is not working. Both fields have the same type, Number - Long Integer.
Im trying to open my database switchboard without having the whole Access program open. Is there a way to have only the database open without the whole program?
Thanks