Inserting A New Field With A Fixed Value
Oct 19, 2004How do I add a new field to an existing table so that the same value is automatically entered for all the records in that new field.
View RepliesHow do I add a new field to an existing table so that the same value is automatically entered for all the records in that new field.
View RepliesI need to show two decimal places on a form based on a recordset of a table that has a field - type = double, format = fixed, and decimal number = 2
I need to show 101.00 and 102.00 so if user insert a record, record would have a sequence id of 101.05.
How do I create that field by code? The table is part of a system loop that it changes everytime thats why I have to recreate the table again and again.
I can do the double, I cant do the fixed and decimal number.
Please please help.
Thanks.
NEVER MIND, I FIGURED IT OUT.
Instead of including it with the code, I tweaked how the form displays it.
Thanks.
I have a column in my table, and its size is set to 10 characters. In a form, i have a combobox based on that column, which contains the values "Corrective", "Preventive", and "Supplier". both Corrective and Preventive are 10 characters, and fill up the field to its max, however, Supplier is only 8 characters. When I look back in the table data, there are two spaces after Supplier. Basically, I can use the arrow keys to "see" the two blank character spaces. Why is that? Are these extra blank spaces taking up space they shouldn't?
View 3 Replies View RelatedI have a pivotchart which I cause to take a huge list of people's test percentiles and calculate the average for each year. I then display the average above each bar. The problem is that there are too many numbers after the decimal place for each figure. I went into the properties and changed the number format to "fixed" but it doesn't give me the option to change the number of decimal places that are used (it does every where else in MS Office!). It seems that it just uses the regional settings for the computer. But the problem I have in changing that is that I have other pivotcharts in the same report that does something similar but needs a different number of decimal places. Is there any way around this without having to create another query to calculate the average and then having the pivotchart display the info from the new query (this is a huge database that I put together with many charts and I don't want to have to redo the way that it works just because of this decimal place issue)?
View 1 Replies View RelatedHere is what I am trying to do. I have a query with 2 fields. "Time In" & "Time Out". What I would like to happen is this. Whenever a character, let's say a "t", is entered into that field I would like the current time to populate that field. Right now we are actually typing in the time. I have the fields set up as DateTime fields currently.
View 10 Replies View RelatedHello everyone - what I have is a a set of default text's that I need to be able to insert into a memo field - this is how I've set it up (Access 2000)
A table with the text fields in it called wordings
table comprises of
Id field
wordingnme (txt)
wording (Memo)
and I have a combo box on a form which looks up the wordingnme and hold this info - I need to have a button that will take this wordingnme and insert the wording that it relates to into the field of my record - Called Endor (memo)- I will have many text s say upto 50-60 but when I insert these into endor field I will probable only use say 5 or 6 at any one time on the record line so an example follows
line 45 in endor I wish to insert wordingnme "A" and then Wordingnme "B"
I also will do some free form type within this - any idea's :eek:
Hi,
Am currently working on a project for AS IT. one problem that i need to come across is trying to see data in a field that comes from a query?!?! Confused?! so am i!
When i first open the form, a paremeter query appears asking me to insert a surname (which i have created) when i insert the surname....and click on the drop down button, it gives me three values...ForeName, Surname and class
When clicking on the pupils name, i want the Class of the student to be inserted into the Class Field!
Can anybody help?
Danbwest
Hi,
I'm trying to insert a record into an Access database from some ASP Code.
I have:
...
strSQL = "INSERT INTO tblUser (UserID, Date, Comments) VALUES " & _
(" & nID & ", #" & Now() & "#, " & "''" & strComments & "');"
conn.Execute(strSQL)
...
I'd have thought this should work but it doesn't.I just get a "Syntax error in INSERT INTO statement".
My date field, called "Date" (just in case that's a problem!) in my database has no input mask defined, it's just a basic date/time field. I've tried replacing the '#' symbols with single quotes, and doesn't work either. I haven't had any luck finding a definitive example of how to do this, even though it's trivial surely. All the similar examples I've found talk about how to update a record set with a date, or how to set the system locale, etc.
Any ideas as to what I might be doing wrong?
Hi Guys, my first post hereim making a database for work and need to figure out the followingi have two people that uses a ms access db, each entering data.i made a custom macro in the vb editor:Public Function cUsername() cUsername = Environ("USERNAME")End Functionwhat i want to do now is, everytime a new entry is added in the table, it should add that username to the "user" cell... it should only do this once, so for example, when i enter data it will show "albert" and if i was to close it, login as "steve" it should still show "albert" under the ones i added, and not steve...this needs to be in the table not a query or form...thanks for your timeAG
View 2 Replies View RelatedI want to update an MS Access table date field with a blank date. How do I go about it? Right now, if the "dateAskFor_Funds" text field is blank, and I try to update the "AskFor_Funds_Date" field in the database, I get an error. That is why I don't do anything.
What expression should I use in the place of
intJunk = 1
in the code caption below.
Private Sub cmdUpdateApplication_Click()
Dim todaysDate
Dim intJunk As Integer
Dim rst As ADODB.Recordset
todaysDate = Date ' MyDate contains the current system date.
Set rst = New ADODB.Recordset
rst.Open "EA_Apps_List", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
…
…
…
If IsNull(Me!dateAskFor_Funds) Or Me!dateAskFor_Funds = "" Then
intJunk = 1
Else
rst!AskFor_Funds_Date = Format(Me!dateAskFor_Funds, "Short Date")
End If
…
…
…
Set rst = Nothing
End Sub
I have a form with many fields and one field has an OnChange event to run an insert query or log an entry in a table about the change. I get insert entry written with everything except one field.The OnChange event code is:
Code:
If AddressStatusFld = 2 Then
'If it has changed from Current to Non-Current create a Contact Log entry for this matte
If (Val([MatterShortNoFld]) Mod 2 = 1) Then
Me.OperatorFld = 16
[code]....
I just can't work out why the record in MatterContactsMade table has a null value for the field Operator.
I like to store SQL code as a memo field in a table. I then use a form to collect selection criteria from the user, and this is used to create a 'WHERE' clause which is then appended to the stored SQL. This has always worked, but in one recent case the SQL failed. On examination I discovered that although the SQL is correctly stored in the memo field, when Access retrieves the code it inserts a space character in the middle of one of the words, thereby of course creating an invalid SQL string. It's easy to work around it, but why this happens? A bug in Access?
View 1 Replies View RelatedI've got a table - "Products" - in my database, with a text field - "Info" - which contains info about products.
Within this field I would like to have footnotes. To do this, I think the best way to do it is by putting numbers inside the text at the location of where I want the footnote to refer to. These numbers will actually be foreign keys to a table called 'Footnotes'.
I can then program the forms and reports to show any numbers as superscripts or whatever.
(Of course, if the user will actually want to insert a number into the text field which is NOT a reference to a footnote, I will have to make a workaround e.g. by making access put a symbol in front of the number, so access will know the number is just part of the text (and I will program the form to not show the symbol in front of the number)).
Is it wrong to have foreign keys within a text field? I think if executed correctly, it should work perfectly.
Is there a way to insert a hyperlink in a field title on a table? For example, I have a field that is a check box for whether the person has taken a class. What I would like to do is insert a link in the field title for that class so I can click on it and bring up the supporting documentation in a PDF file for that class.
View 4 Replies View RelatedI'm using Access 2003.
if I create an Import Specification, how do I add an extra field in the middle of the field list? All I can see to do is re-enter all fields from the new field downward.
I have a form, has some fields, one of them is the current date, so when the user click (save )button , which make (add new record )to the only table I have the problem that .all fields are inserted in the table , except the current date !! it is a text box ( Now() )!!
View 1 Replies View RelatedI have a form for entry and some fields are computed or result of a query from another table. I have a function that looks up a value from another table like so
************************************************** ********
Public Function GetTargetType() As Variant
GetTargetType = DLookup("type", "tblFormulations", "[tblFormulations!formulation]=Forms![frmNmsConsumptionEntry]![formulation]")
End Function
************************************************** ********
Which works fine when I test in the immediate window.Then I have this form event. This however does not insert this value when I am adding records using my continuous form.
************************************************** ********
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!target_group = GetTargetType()
'Forms!frmNmsConsumptionEntry!target_group = GetTargetType()
'[tblNmsConsumption.target_group] = GetTargetType()
End Sub
************************************************** ********
making sure I can insert this value once retrieved.
I have a query that gives me a table with one column, say column A.
I need to add 2 columns to the table and the coulmns will have fixed value.
So I need to add column B and column C to my table and all rows in column B will have a fixed value and all rows in column C will have a fixed value.
What I have:
Table with one column
Column A
a
b
c
What I need:
Table with 3 columns:
ColumnA Column B Column C
a 12 14
b 12 14
c 12 14
Any help will be greatly appreciated.
Thanks
In Access, can I hard code a parameter value to suppress the prompt? I'm querying a query that's made up of sub queries, which all require the same parameter.
I'd like to define the parameter value in my SQL statement so there is no prompt. Can this be done directly in my Access query?
Again, the parameter isn't any part of my main query, it's part of the sub-queries that make up the master query if that makes any sense.
Dear All,
I need some help. I am writing a database for my new and small company. I receive internet orders from my ISP in an email. I want to find a simple way of automatically importing these emails into my "Customer Information" table.
The issue is that I have no control on the format of the email I receive from my ISP. The data is fixed width and stores the information horizontally rather than in columns. For example:
Quantity : 1
Price : GBP 199.00
Delivery : GBP 5.00
Total : GBP 204.00
I have been exploring the GetData option and using the advance settings to align fields. It seems (and I am not an expert user of Access) that the GetData function relies on the import source to be aligned in vertical columns rather than horizontally. This makes mapping the fields almost impossible.
Does anyone have a clever work-around? Either in Access or manipulating the data before it goes into the database?
Many thanks, Matthew (matthew@byatt.com)
Hey all, i just would like to know if there is a way to have a fixed number of records in a query.
Let's say, example (a), a query returns 2 records (qry1); i would like to have my query (qry2) to have 5 records, so the first two records will appear and then 3 blank records. (b) A query (qry1) returns 4 records, then this query(qry2) should return the 4 records plus a blank record
.........qry1.......qry2
a)|>record1....|>record1
...|>record2....|>record2
...|*______....|>______
....................|>______
....................|>______
....................|*______
.........qry1.......qry2
b)|>record1....|>record1
...|>record2....|>record2
...|>record3....|>record3
...|>record4....|>record4
...|*______....|>______
....................|*______
Why do i want to do this?
Because i want my report to show 5 records so when i print it i have those blank spaces to fill if necessary.
I want to have this:
______
lrecord1l
lrecord2l
l______l
l______l
l______l
Instead of:
______
lrecord1l
lrecord2l
What im doing now is creating a temporary table and add the records to it plus blank records.
What i used to do was add blank records in the same table meting the criteria of the report, so they will appear. After close the report, those records would be deleted.
I would like to know if theres another way, like a command in sql, or maybe some property on the report. What ever is most efficient and a good database practice. Thanks in advance
Hello all,
I'm trying to export a table to .csv file, but I want fields with null values to be padded with spaces. ie. if the field length is 50, but there is a null value, I want all 50 spaces.
Anybody know if this is possible?
Thanks,
Clanure
I've been creating a database. I prepared forms to enter records. In these forms there are many fields. I want some fields to stay fixed while going up to next record unless changed. How can I do this?
View 6 Replies View RelatedHey guys,
I searched the forums and couldnt find anything that directly related to my issue. What I am trying to do is export a fixed-width text file, but the issue is that the file has to be line feed only. By default Acces creates CR/LF and the client's import specification only allows for Line feed.
I am currently using a macro, with export specification, to create the file. Due to time constraints and other obligations, I am really trying to avoid VBA programming.
Thanks in advance,
Jahaines
1. how do i import a word document as a template to ms access Report file i did Ctrl + A to select all copy then paste it pasted it well u can say good but when u preview its not an actual page size its much smaller and theres no way to re-size it is there a way to copy or import it perfectly to the report file in access?
and the second question
2. in a form where you choose source code (i think) i merged in 1 table the FirstName and LastName i remember doing something like
Code:
[FirstName] & " & [LastName]
now when i preview the report after selecting my data from combo box it prints fine i mean merges the FirstName and LastName to 1 box but its not a fixed position i mean i placed the text box above the line "Fullname:_______"
but when i preview it depending on the lenght of the table it moves too left or too right and i cant control it is there a way to fix its position? because if the name is too short or too long the text just dances and i changing the position of the textbox doesnt
I have a table I need to export most fields are left align but there are two that are right align, I have tried to use the Space Function but it does not work well, I have also tried using the Rset in a vba module and thought it was working but now it is not.
View 10 Replies View Related