Functions Running Before They Are Called
Dec 12, 2007
Hi, I have a strange issue. Every now and then, when i start up my database (still in development) it either asks me for a value thats used in a sql command, or faults with an error saying it cant reference a value. The stragne thing is that the values that get pinged are not set until im a few forms into my database, and shouldn't even be thought about by the database yet. Is there something im missing here?
An example,
It asks for a change reference number on login form load, however that value isn't called until a button is pressed on the menu form which loads the change form. That same button sets the change number
View Replies
ADVERTISEMENT
Mar 2, 2006
I am in a form that someone else created. It has 3 tabs to the form. It is almost like Excel, but the tabs are at the top, as opposed to the bottom. Are they called tabs, pages, or subforms or something else? I can't figure out how to add one to a different form I have created.
View 2 Replies
View Related
Feb 6, 2007
What I want to do, is have an unbound form, user enters data in to it, then clicks on a 'save' button which then writes the data to a new record within a table
I have got no idea what it is called so find it hard to do the search.
View 14 Replies
View Related
Jul 22, 2005
A stupid question here...
I have a form that has a single bound text box that is set to currency. The table is also set as currency with decimal places set at 2. I have my own save button
Now I want to catch if the user types in text instead of numers and display a suitable error message.
When the user presses the save button I call this code:
DoCmd.RunCommand acCmdSaveRecord
heres the before update event
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo errHandle
If Not IsNumeric(hourlyRate) Then
MsgBox "Please enter a number for the hourly rate", vbInformation
hourlyRate.SetFocus
Cancel = True
Else
If (hourlyRate < 0) Then
MsgBox "Please enter a positive hourly rate", vbInformation
hourlyRate.SetFocus
Cancel = True
End If
End If
Exit Sub
errHandle:
MsgBox Err.Description & " " & Err.Number
Resume Next
End Sub
However the update event isnt called and I get an access message saying that the value you entered isnt correct for the field blah blah blah.
Q - How do I stop this access message from being shown???
btw - If I enter in a negative number my message box is shown, and then i get another access message saying that the run command was cancelled.
arghhh - I dont want these :-)
View 4 Replies
View Related
Sep 15, 2006
I've got a mental blank, I want one of those things that is a text box with little up and down arrows on the right so you can choose a number. What's it called?
View 9 Replies
View Related
Jan 5, 2008
In Access 2000, I am using a form with fields for TimeStarted and TimeFinished. After the user has filled in the TimeStarted, the After_Update event sets TimeFinished to one hour after that. I would like to use what I think are called "Spinners" so that the user could simply click on increment or decrement buttons to change the FinishTime.
I'm not sure about the name of the feature, so it is hard to find help to get started. Would appreciate any guidance. Thanks, Andrew Thorpe
View 5 Replies
View Related
Mar 6, 2006
Hi,
To make a long and tedious story short:
Does anyone know why Access (2003) creates an index called PrimaryKey and an index called User_ID when I'm in the table design view and ask it to make the User_ID field the primary key?
After years of database development I've only just noticed this. Not normally not a problem but for this:
Use ADOX to find the field name of the primay key for a table. I took the code right out of a Access 2000 developers handbook. It creates a collection of the table indexes and steps through them one at a time checking if the PrimaryKey property is true. It hits the index called PrimaryKey and says 'yes it's true, this is the PK', I then go on to use the index.name property in an SQL Select to create an ADO recordset. The only thing is that the index called PrimaryKey is not a field name and the field name User_ID is not a PK :eek:
I go into the indexes list in table design and delete and re-create the indexes and PKs as I want and the code works fine.
So, again, why does Access do this? I'm so confused! :confused:
View 4 Replies
View Related
Aug 27, 2015
Is the calling Form name or the event handler's sub name available in called module? I need it in order to determine the form's name as in [Forms]!someformname!some control.
View 7 Replies
View Related
Aug 11, 2011
Is there an easy way to propogate a value from one form to another?
I have two forms: Form A and Form B
Form A is the main: it contains many field including a Supplier CB.
Form B allows the user to add a new supplier if it is not on the list..
Form A allow user to pick a list from the table of suppliers. I allowed edit ietm list in the properties to add the list of suppliers to grow as new supplier are entered. I pointed the user to Form B ton enter the new supplier.
Things going well as I planed, however it is annoying when I enter the new supplier in Form A and respond "yes" to add new items I have to retype the new supplier in Form B again. I have about 11 fields in Form A that will follow this theme. This will not be user friendly if not fixed.
View 4 Replies
View Related
Oct 19, 2005
:eek: :eek: :eek: :eek: :eek: :confused: :confused: :confused:
I am trying to update a database table via a command button on the main form, that uses tabbed sub forms.
The database gets its data from paradox data tables copied our company's
third-party software. These table files are copied from one location to another to stop the paradox database from locking up and giving me errors during the import process of this database. I then link to these files at a pre-determined location on a local computer hard drive.
When I try to run the code below I get the error about the table being
locked by a user or process. As you can see I have tried adding a pause
incase the files are still being copied but this does not seem to be the
problem.
I have used a msg box to confirm that the copying process has completed before starting the make query, but the same error comes up after I click ok.
Can anyone suggest anything else.
As you can see from the simplicity of the code below I am a beginner so take it easy on me, by not taking knowledge for granted. :)
code:
------------------------------------------------------------
Dim response
Dim stDocName As String
Dim stLinkCriteria As String
response = MsgBox("Are you sure that you want to update xxx with Customer
data from xxx?", vbYesNo, "Perform Update")
If response = vbYes Then
‘pause software to let any pending work to be completed
Sleep (5000)
‘close active form
DoCmd.Close
‘close all active forms
Do While Forms.Count > 0
DoCmd.Close acForm, Forms(0).Name
Loop
‘pause software to let any pending work to be completed
Sleep (30000)
‘delete existing file
Kill "c:folderfile DATA.DB"
‘replace with new file
FileCopy "J:Folderew_DATA.DB", " c:folderfile DATA.DB "
‘pause software to let any pending work to be completed
Sleep (40000)
DoCmd.SetWarnings False
stDocName = "Make_DATA"
DoCmd.OpenQuery stDocName, acNormal, acEdit
‘pause software to let any pending work to be completed
Sleep (35000)
stDocName = "Make_DATA_SUMMARY"
DoCmd.OpenQuery stDocName, acNormal, acEdit
‘pause software to let any pending work to be completed
Sleep (35000)
stDocName = "qry_Update_ Status"
DoCmd.OpenQuery stDocName, acNormal, acEdit
‘pause software to let any pending work to be completed
Sleep (35000)
‘open up main form when finsihed
stDocName = "main-form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.SetWarnings True
Else
End If
View 3 Replies
View Related
Sep 8, 2013
This module is giving me the "undefined function" error message when I try to run my query. I don't know why, but I have checked that there are no references with "missing" and there are not. I also added the word "Public" to the function becasue that was advised by another forum user. I thought it worked perfectly the first time I ran this query, but now it is not working and I do not recall making any changes. I have called the module basFunctions:
Option Compare Database
'************************************************* *********
'Declarations section of the module
'************************************************* *********
Option Explicit
'================================================= =========
' The DateAddW() function provides a workday substitute
' for DateAdd("w", number, date). This function performs
' error checking and ignores fractional Interval values.
'================================================= =========
Public Function DateAddW(ByVal TheDate, ByVal Interval)
Dim Weeks As Long, OddDays As Long, Temp As String
[code].....
View 3 Replies
View Related
Sep 30, 2013
I'm using shellexecute in my form whenever a picture is clicked the respective program/ application will open to show the picture. Because I want to see the picture more clearly by zooming it in or out. But the problem is I don't know how to disable the delete button and prev./next button, because I want the user use the program only to zoom it in.
View 4 Replies
View Related
Oct 16, 2014
I know its not possible. But Just wanted to confirm. Not at all possible?
Code:
Function PreImport(BookToImport As Workbook)
For Each cell In BookToImport.Sheets(1).Rows(1).Cells
cell.Value = Trim(cell.Value)
Next cell
BookToImport.Sheets(1).UsedRange.Rows(1).Replace ".", "_"
End Function
View 1 Replies
View Related
Jul 10, 2014
I have a continuous form... and I want to filter the table in the background using the text box called "Badge" (boxed in red in my picture.) You can see the corresponding part over in the filter field. When I display the form, though, Access still asks me for the Badge value, so it's not linking. What formatting am I missing to properly refer to the field?
View 5 Replies
View Related
Mar 14, 2005
Can anyone tell me how to get a running balance on a report. I know how to create a running total, by setting the "running sum" property of a text box to "Over all".
I can't however see how I can adapt this to give a running balance (as in a bank statement for example). Attempts to do so end up in failure!!
Many thanks in advance.
Peter
View 2 Replies
View Related
Jan 8, 2013
I am making my very first tentative steps to convert my most complex Access 2003 app to run under Access 2007. There are no obvious problems when simply opening my original MDB file in Access 2007 or running it after conversion to an ACCDB file. However, when I try to run the ACCDB file under the Access 2007 Runtime I get a "You can't carry out this action at the present time..." error. This is then followed by the "Execution of this application has stopped due to a runtime error..."
To be more specific, I only get that error when I deliberately hide the back end database and thus invoke code triggered via Autoexec to allow the user to browse for the missing database. This code works fine when running under normal Access 2007 so it appears to be a Runtime issue.
View 3 Replies
View Related
Nov 18, 2013
I am struggling trying to execute a function inside a Form_current event to display some stats.
The Function is this:
Code:
Function FlightsByAircraft(Aircraft As Long) As Long
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim str As String
str = "SELECT * FROM tblFlights WHERE AircraftID = " & Aircraft
[Code] ....
The code for the Form_Current event is this:
Private Sub Form_Current()
txtStats1 = FlightsByAircraft(Me.AircraftID)
Very simple. Well, the problem is when I move to a new record, a error message comes up: "Run-time error '94' - Invalid use of Null". It is because the AircraftID is not populated at that time. I tried to insert in the function code something like that:
Code:
If IsNull(Aircraft) then
exit function
else
.... (the DAO.Recordset code)
but it doesn't work.
View 8 Replies
View Related
Nov 16, 2013
And then called this join as a symbol or variable, and then have it use to select the items from these joined tables, can this be done in Access? Here is an example of a code that I created, but it has an error message saying the FROM syntax is incorrect.
Code:
SELECT firstJOIN.trainID, firstJOIN.trainName, firstJOIN.stationID, firstJOIN.stationName, firstJOIN.distance_miles, firstJOIN.time_mins
FROM (trains INNER JOIN ((station INNER JOIN lineStation ON station.stationID = lineStation.stationID)
INNER JOIN bookingLeg ON bookingLeg.startID = station.stationID or bookingLeg.endID = station.stationID )
ON trains.trainID = bookingLeg.tid) as firstJOIN
Can Access do something similar to this, in the FROM statement I joined 4 tables, because each unique fields are in each table and I have to joined them to get those fields. I called this join firstJOIN and in the SELECT statement, I list those columns in the table by calling it firstJOIN.trainID. Can Access do something like this, but syntax it differently?
View 6 Replies
View Related
May 16, 2005
I have several forms that can be called from more than one other form, but I need to build my forms so that the user is returned to the form from which they started.
I have looked in the help files and FAQ and I can't find what I am looking for.
Please, can someone direct met to the required information or tell me how to achieve this?
Thanks,
Kev.
View 1 Replies
View Related
Jun 15, 2005
i have the following line:
Me.Text2 = Right(Me.Text0, InStr(1, Me.Text0, ".") - 1)
and i would like that if Text0 is "test.exe" i want to return "exe", however, with the above i am getting ".exe" ... can someone tell me what i am doing wrong please ?
Thanks
View 4 Replies
View Related
Jan 4, 2005
I currently have a text box that is calculated off of 6 other text boxes. I want the one field that is calculated to update any time I change any of the other fields. I can do this by putting the same calculation in each ones afterupdate event. Below is one section of my code for the arithmetic, and I want to perform that code many times. Can I use a function to do this, and if so some help would be nice? thanks
Private Sub HEAVY_AfterUpdate()
Total_Sheets = SECOND + HEAVY + LIGHT + SCRAP
Total_Sheets = Total_Sheets * YIELD
Total_Sheets = Total_Sheets + D_Sheets
Total_Sheets.Text = Val(Total_Sheets)
End Sub
View 2 Replies
View Related
Aug 18, 2004
In access, I'm trying to create a database to track material that has an expiration date of one year from the appointment letter date. I'm not sure what I need to do here. Here's what I have: I have a table that has fields for the individual (UNIT), the appointment letter date (Appointment Letter Date), and a True/False field (Out of Date) that I want to make True when the current date is greater than the (Appointment letter date + 365 days). Is this possible through Access tables and/or queries or will I have to incorporate VB? I am an extreme novice when it comes to expressions and query building in Access.
Nathan
View 6 Replies
View Related
Aug 17, 2005
Hi,
I have build a database which work perfectly on most computers. But one or two for the computer are error with the Left, Right and Date SQL function. Is it simplely miss for the install or it a problem with my code?
Thanks
View 2 Replies
View Related
Jan 12, 2006
Hi everyone,
Thanks for taking the time to read this.
I will firstly give you the low down on the business that I am doing the database for. It is a Car Restoration Business, where we deal with vintage/classic/muscle cars and restore them to the former glory.
I do not know Microsoft Access very well, I have attached a file with what I think is a databae :) I could be wrong. The main function of this database is to search for suppliers for a specific car part for a specific car.
So if I want to find a doorhandle for a 1970 Ford Mustang, I need the suppliers pertaining to those criterias to come up.
How do I get this to happen?
Thankyou for your help
Jess:confused:
View 2 Replies
View Related
Nov 3, 2006
Hello,
I have developed a MS Access database which uses several functions such as DateDiff and inStr. When I use these function on my machine the database runs fines and the values are calculated.
However the database I have developed is not for my computer and when run on this one computer produce some errors (The date function is mentioned). I believe this is some sort of security issue but I cannot be sure.
Both computers run the same version of Office. Does anyone have any ideas.
View 2 Replies
View Related
Nov 3, 2006
Hello,
I have developed a MS Access database which uses several functions such as DateDiff and inStr. When I use these function on my machine the database runs fines and the values are calculated.
However the database I have developed is not for my computer and when run on this one computer produce some errors (The date function is mentioned). I believe this is some sort of security issue stopping her running the functions.
Both computers run the same version of Access. Does anyone have any ideas.
View 3 Replies
View Related