Can't Change Value In DB Field
Hi - I'm using Access 97 with DAO 350. I can't seem to change the value of one of the fields.
Code:
Dim DBL As Database, RSL As Recordset Set DBL = OpenDatabase(App.Path + " gnsn.dat", False, False) While InStr(nlist, ",") > 0 tmp = "Select ALTERNATE,CNT,STANDARD From GIVEN WHERE ALTERNATE like 'GEO'" Set RSL = DBL.OpenRecordset(tmp$, dbOpenDynaset) If RSL.RecordCount > 0 Then RSL.MoveFirst MsgBox RSL!standard 'Shows GEO RSL!standard = "GEORGE" MsgBox RSL!standard 'Doen't change. Still shows GEO End If DBL.Close Set DBL = Nothing Set RSL = Nothing
Thanks
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Change A Value In A DB Field?
It's me again.
Here's my latest problem. I'm writing a program for a friend to use in his shop. People come, order items and he uses the program to show his stock, select the items and place them in a shopping basket and then process the order.
I'm using 2 datagrids for this. The first one displays his products, including the number in stock and the price ...etc. When he dblclicks an item, it's passed to the secong datagrid, which is effectively the customers temp shopping basket. Obviously when they select an item, they state how many they want, I've got this working correctly, the select a quantity and this is displayed with the product name in the second datgrid.
Now, my problem is this. Lets say for example the customer selects two of a certain item, I need the second datagrid to reflect this in the proce. In other words, they order an £8 item, the price needs to be doubled to £16.
I thought maybe I should use the Querydef command but I'm not sure. Any help?
How Can I Change The Name Of Field In ADO
Hello everybody
I am a newbie, I have a question...
I have to change the name of field in ADO, I have tried but I can't, So I want to ask you how can I change the name of field in ADO/DAO? Thanks
Change The Name Of The Field
Hi,
I want to change the name of the field when my form loads. Could someone please help me how to do that.The name of my field is Section and I want to change it to Section1 the name of my table is Newlaw.
Daisy
Change Field
Hi:
I have this litlle piece of code:
Code:
SQL = "ALTER TABLE fichas ALTER COLUMN Anilha Pai Text(50)"
db.Execute SQL
This two lines change the size of the field Anilha Pai,but I have a little problem here...like you see the name of the field is "Anilha Pai"(I have a space between the two words),and the VB don't recognize the field because of this space.
Any suggestions,please, for VB recognize the field?
Thanks
Change The Name Of The Field
Hi,
I want to change the name of the field when my form loads. Could someone please help me how to do that.The name of my field is Section and I want to change it to Section1 the name of my table is Newlaw1.I am using Dbase IV to do this I think i would use the ALTER command in SQL but i don't know how. could some one please help me.
Daisy
Vba Email: Change 'from' Field
Hi people,
I was looking for something that could change the from field in an email message and found this thread.
http://www.xtremevbtalk.com/showthread.php?t=175686
I've tried to code in this thread and the code from:
http://support.microsoft.com/?kbid=198629
which looks like this:
Code:
Sub AddReplyRecipients()
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oUser1 As Outlook.Recipient
Dim oUser2 As Outlook.Recipient
Dim oMyItem As Outlook.MailItem
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oMyItem = oApp.CreateItem(olMailItem)
oMyItem.Subject = "test"
oMyItem.Body = "Hello, body"
' replace "User1" with a valid e-mail alias
Set oUser1 = oNS.CreateRecipient("senderemail@test.com")
oUser1.Resolve
oMyItem.ReplyRecipients.Add oUser1
' replace "User2" with a valid e-mail alias
Set oUser2 = oNS.CreateRecipient("recipientemail@test.com")
oUser2.Resolve
oMyItem.To = oUser2
oMyItem.Send
Set oMyItem = Nothing
Set oUser1 = Nothing
Set oUser2 = Nothing
Set oNS = Nothing
Set oApp = Nothing
End Sub
the weird thing is that the message gets send by and to the last email adress which is recipientemail@test.com
this part:
Code:
Set oUser1 = oNS.CreateRecipient("senderemail@test.com")
oUser1.Resolve
oMyItem.ReplyRecipients.Add oUser1
doesn't seem to do anything as i can comment it out and have the same results.
I'm probably doing something wrong as it seemed to work for some of you (planetwise, btw i tried your code too with the same result)
Any suggestions anyone??
Thanks in advance!
Cheers,
Arie
Change Field Sizes
I cannot figure out how to change the field size of a field in an access table. Does anybody know how to do this? Please help!
Change And Existing Db Field Name
i have a project using access db and the db has different fields in it and i want to be able to change the name of a field but not delete them (JUST rename it and hold the infor already in the db.)
Change Field Type
Hi.
I have an sql database with a table that contains a real field that i need to change to decima.
now is:
cantidad real not null default 0
and i need:
cantidad decimal(28,6) not null default 0
I need to use SQLDMO in my vb6 app to do that.
Thanks for your help
Change Field Name In A Subquery
hY, I'm using an adodc control to populate a datagrid control.
The recordsource of the adodc is associated to the following sql statement:
filter = "SELECT name, (SELECT cityDescr FROM cityes WHERE cityes.postalCode=muscians.pc) FROM musician WHERE intrument = 'keyboard'"
I get a record with the folloing fields:
name
expr1012
How can I change the name of the second field (field1012) generated by the subquery? I'd like to visualize "address" instead of expr1012 in the datagrid column
Thanks!
mic
Change Field Value (insert Into?)
OK. I have a table, with fields1, 2, 3.
I need to change all values of field 3 to "value1".
I know how to drop a field
Code:
ALTER TABLE table DROP field3
but how can I change values?
Do I need do drop it and then insert into?
if so, how.
PS. Oh, I forgot, I'm using MS Access (2003).
tx
matej
Change Field In Ado Connection
Hello,
I have a form with an ado connection to a database by having the text boxes linked to the fields.
But I have one field that doesn't have a text box set to it, but I need to add a value to it.
How can I do it?
Thanks in advance...
Change Field Size With DAO 3.5
Is it possible to change the size of a textfield, using DAO 3.5?
using the following alter table statement only seems to work with DAO 3.6.
Code:
ALTER TABLE Authors ALTER COLUMN Author varchar(57);
Malloc
Change Field Allow Zero Length
Hi to all:
I would like to change the field allowzerolenght,set to false, to true in my DB access.
Any suggestions to do this?
Thanks
Change A Field In Database
Hi People:
I need to change a lenght in a field in my database.
This is possible?If yes can anybody put a code for do this please?
Thanks
Change Field In Ado Connection
Hello,
I have a form with an ado connection to a database by having the text boxes linked to the fields.
But I have one field that doesn't have a text box set to it, but I need to add a value to it.
How can I do it?
Thanks in advance...
Change Field Type
Hii Someon can help me
How can I change all field type to TXT type in my MDB File
I have 200 fields.
Ex: TimeStart (Date format) ----> TimeStart (txt format)
FirstValue (Double format) ----> FirstValue (txt format)
etc
from VB
Thanks!
How To Change Field Specifications
Dear All
(1) I have a database with about 43 tables filled with records.(about 500)
I need to change in some of the tables the field size.
Example : In the Supplier_Master Table I ahve the Supplier_name as
Varchar2(20).
In practice the user finds that this is not enough and wants to increase the
same to say Varchar2(40).
I really dont know how to do it.
What I did was to create another table with varchar2(40), transferred all
the Records from the Old table to new table
via the code. Then I dropped the original table Supplier_master and then
created a new table Supplier_Master with new varchar2(40) for the
supplier_name.I then retransferred all the data from the new table again
back to Supplier_Master.
This is no doubt a tedious and timeconsuming procedure -- Is there any
better method to solve this problem
(2) Also if I have to change the order of field is it possible in the same
table or I have to do the same as above which will be more complicated as
now the data transfer order will have to be carefully monitored or coded.
Any Help or guide line will be appericiated
Turab
Change Field Size
Hello,
I have a table where a field's size is set to '9'. I need to expand it to '15', by code.
I'm using VB 6 SP5, ADO, Access 97.
Thanks
------------------------------
Fabio Centenaro
frcentenaro@yahoo.com
How To Change Field Datatype In VBA?
Hi dear
I have two database having the same tables.and each table in the source database have corresponding fields with the table in the destination database.
I have the following function which checks if there are fields having different datatypes and sizes.
Code: Function GetMismatch(strSrc As String, strDst As String, strTableName As String, strFieldName As String)
Dim SrcDB As Database, DstDb As Database
Dim strSrcSize As String, strSrcType As String, strDstSize As String, strDstType As String
Set SrcDB = OpenDatabase(strSrc)
Set DstDb = OpenDatabase(strDst)
On Error GoTo ErrHandler
strSrcSize = SrcDB(strTableName).Fields(strFieldName).Size
strSrcType = SrcDB(strTableName).Fields(strFieldName).Type
strDstSize = DstDb(strTableName).Fields(strFieldName).Size
strDstType = DstDb(strTableName).Fields(strFieldName).Type
If Not (strSrcSize = strDstSize And strSrcType = strDstType) Then
lstFieldMismatch.AddItem strTableName & " # " & strFieldName
End If
ErrHandler:
If Err.Number <> 0 Then
MsgBox "Unexpected error number " & CStr(Err.Number) & " occurred in " & _
Err.Source & ":" & vbCrLf & vbCrLf & Err.Description
End If
End Function
So, if the function gets any mismatched fields I want to make the source field datatype and size same as the destination field datatype and size.
Thank you.
Auto Change Date Field
What's the easiest way to do this? I want the date field in my table to automatically reflect the date of the last time the record was updated. Can I do this in my setup of the table, or does it have to be done in the form?
How To Change Access DB Field Type, DAO
I use VB6 with access97 DAO and I cannot change a field type in code. Is there a way of doing it ?
I want to change a field from dbLong to dbSingle. I would prefer not to lose data, but if I have to, I have to.
Change The Type Of A Database Field
i have a databaset dao in access and have about 100 tables inside it and in each table there are two fields and they are a dbtext type.
i NEED to make all of them dbmemo i tried this
dim db as database
dim tb as tabledef
set db = opendatabase(bla bla)
Set tb = db.TableDefs("model")
tb.Fields("symtoms").Type = dbMemo
tb.Fields("remidi").Type = dbMemo
set tb = nothing
set db = nothing
and it won't change them.
Change The Length Of An Access Field
I issued a program a while back which has a text field 'sName' that has a length of 20
I want to change it now to a length of 30 with a patch so that a whole bunch of users don't try and open Access and inundate me with calls for the things they screwed up when they got in there and started playing.
I am reasonably sure that there is a SQL command to do this in ADO, but I can't find it.
Any help here?
How To Change The Required Field In Access DB?
Spend several hours on the board and couldn't find anything about it
so here he goes....
When I create a Access DB file how/where do I set the command so that I can change 1 field to be "Not Required" ?
ADOXtable1.Name = "Addressbook"
ADOXtable1.Columns.Append("Prefix", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable1.Columns.Append("Firstname", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable1.Columns.Append("Middlename", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable1.Columns.Append("Lastname", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable1.Columns.Append("Address", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable1.Columns.Append("ID", ADOX.DataTypeEnum.adDouble, 10)
ADOXcatalog.Tables.Append(ADOXtable1)
With this all Fields are Required when I look in Access,
how to change it to NOT Required?
Thanks
Change A Date Field To Blank
I am working on a timekeeping application that requires the user to enter a time value into a masked edit box. This time value is saved in an Access database.
If the user is reviewing entries and discovers that there is a time value entered where there should be none the field in the database should be changed from a time value to an empty field.
I can't figure out how to do this. If I try and enter a "" I get an error, if I try and enter a 0 I get an error.
I can't find any reference on how to change a date field from one with a value to an empty field.
Change Field Variable Types
I am not very experienced with data bases, or microsoft access yet and everyone I have asked doesnt know, so I am not even sure this is possible.
I would like to have a pre existing table in a microsoft access data base (that has already been set up with values and variable types set up in each field)
and now I want to be able to change a certain coloum's variable type, for example going from text to number.
also, is there a way that I can set the table to automatically renumber the auto number coloum after an item has been taken out of the list with code.
I have a table with lets say..10 rows in it (1 through 10) and through code, I take out row number 8, so now I want 9 and 10 to be renumbered to 8 and 10 after row 8 was deleted. but as of right now, it stays as 1, 2, ..., 7, 9, 10.
Change Required Property Of A Field In SQL?
Is there any way to change the 'Required' property of a field through an SQL statement? Apparently using ADOX with an existing table does not work. I've checked these forums as well as google.
How To Detect A Change In A Field (textbox)
What I want to do is make my program so that only fields which have actually had something entered into them on the form are updated in the database. The best way I can come up with to do this is by defining a flag for each field and setting it on during the change event for that field. The flag would then be tested during update. Is there some property that can be tested directly without having to define a flag for all the fields and then resetting them? I'm not too lazy to do this, I just want to do it the right way.
Robert
Edited by - projecttoday on 8/28/2004 6:55:18 PM
Change Field Data In Recordset
Can I change the selected recordset field value?
that is after I have made a recordset from a SQL statment
I want to make change of some data in the recordset.
Can I do that? coz I have use rs.fields("XXX") = "XYX" which causes an error
How To Change Access Field Properties From VB
I'm new to VB, and haven't found a good simple way to do this online.... I need to change some field properties of various fields in various tables in Access. It needs to be done in code in VB, not done manually. Is this possible? (e.g., "Indexed" field from "No" to "Yes (No Duplicates)", "Field Size from "Byte" to "Long Integer", "Allow Zero Length" from "No" to "Yes", etc.)
Thanks!
Data Report Change Field Value
Hi guys,
I am using a datareport without the dataenvironment and the report is working fine. I am not using any grouping so dont have to use a shape statement.
I have a button calling rpt.Show and on the report initialise event i have the following code:
Private Sub DataReport_Initialize()
Dim lsSQL As String
Dim oConn As New ADODB.Connection
Dim oRS As New ADODB.Recordset
oConn.CursorLocation = adUseClient
oConn.ConnectionString = General.con
oConn.Open
lsSQL = ""
lsSQL = lsSQL & "SELECT * from tw_customer "
lsSQL = lsSQL & "JOIN tw_product_by_customer "
lsSQL = lsSQL & "ON tw_customer.cust_ref = tw_product_by_customer.cust_ref "
lsSQL = lsSQL & "WHERE active = 1 "
lsSQL = lsSQL & "ORDER BY tw_customer.cust_ref "
oRS.Open lsSQL, oConn, adOpenForwardOnly
Set rpt.DataSource = oRS
End Sub
Ok so basically, I have 3 text boxes on the report design. Depending on one field ( called frequency) I want to put an X in one of the boxes.
I tried the following code in the Initialise section of the report
If oRS("frequency") = "A" Then
rpt.Sections("Section1").Controls("lblfreq_A").Caption = "X"
End If
If oRS("frequency") = "B" Then
rpt.Sections("Section1").Controls("lblfreq_B").Caption = "X"
End If
If oRS("frequency") = "F" Then
rpt.Sections("Section1").Controls("lblfreq_F").Caption = "X"
End If
Now I am getting an X in the first box, but it is in the same box for every page of the report, even though I know that the frequency changes from record to record.
The 3 boxes are in the detail section of the report but only seem to hold the value of the first/last value for all records.
I am presuming the above code is in the wrong section, or the code needs called for every row returned from the data set. Does anyone have any ideas? Any help would be great.
Thanks.
Edited by - toutski on 9/22/2005 8:59:02 AM
Monitor A Database Field Change
hi, i'm a newbie in VB,
i need to monitor any change in a field in a MSAccess db all the time, in order to trigger an output to the serial port. i create a text box and i can trigger the output every time that that box change between the form and that box also is conected to the data base so every time that the form is loaded it brings the current data from the db. my problem is that i want a subrutin that continuosly checks for any change in the database. help!
Change Data Type Of Recordset Field
i have a varible of type double. when i open the recordset from an Excel file the field is assigned the data type adVarWChar. when i assign my double with a value of 18429.80 to the field in the record set it stores 18429.79999999.
is there a way to change the type of the field after its been opened? i tried formatting the column in excel where the field gets binded to but it didnt do anything.
How To Change A Field In Table (Access 2000)
I use the following SQL:
ALTER TABLE MEMBERS MODIFY m_password TEXT(32)
but I get a error: "Error syntax..."
And then, I try with
ALTER TABLE MEMBERS MODIFY m_password CHAR(32)
but i still get the same result
How i have to do?
Dynamically Change Field Values In PDF From VB6 Code
Hello.
I have a VB6 project where I have to print a lot of information about customers. Customer info is stored in Access DB. THe form itself is in PDF format. The PDF document has fields. What I want is to be able to dynamically fill those fields and then print the form with the changed fields. This task should be done with as little human interaction as possible.
What I have:
I have a ocnnection to the DB. I also managed to find code to print PDF object I created in my project. But I cant find a way to change fields inside that object.
Thanks in advance for any help.
J.R.
Dataenvironment Field Does Not Change On Clicking A Checkbox
hi,
I want to change the corresponding field of a record in the dataenvironment when i check corresponding checkbox ....I am able to load the database with intial values in the checkbox field...
Can anybody tell me how can i implement this...
regards,
ssmantha
Change Format Of Yes/No Field In An Access Table
Hi,
When I create a Yes/No field through code the format for the Yes/No field is empty, so any data simply displays as -1 or 0.
How do you change the format of a Yes/No field in an access table to Yes/No (so that when you view it from within access, you see a checkbox)
Thanks
Change Background Color Only When Any Field Is Active
I have a form [In MS Access 2000] with many input fields for gathering data from users.
My users would like the background color to change from gray to white in the active field. When they leave that fileld they want it to revert back to gray.
I can create an enter and exit event on every field on my form, but would prefer and appreciate some help with a cleaner, simpler way to do this.
Thank you
WinDancer
CrystalReport Or ReportViewer Field Color Change???
How do I change the fore color of a field in either a CrystalReport or ReportViewer document depending on the value of another field? For example: I have an Order form,
If the [Order Type Field] = [Normal Order] then
Fore Color of the [Order Type Field] in my report must be Blue
Else If the [Order Type Field] = [Sample Order] then
Fore Color of the [Order Type Field] in my report must be Red
How Can I Change The 'Field Size' Property Of A Column Using VB?
Hi,
This is my first time using a forum, so here goes...
I have an Access app that is in use by several people who know nothing about PC's. I included a few extra columns in each table to store new data elements as needed (the DB is split, so when I write new reports, I can just ship the front end DB).
Unfortunately, I have now tried to create a new field in a form to use a spare number column and found a problem.... The spare number columns have a field size of 'Long Integer', so when I try to use them to store a decimal - the value gets rounded.
I don't want to have to go to every user, making updates to each back end DB in turn, so:
How can I can the 'Field Size' property of a table in a linked DB, using VB in the front end DB, in such a way that a user could execute it (like putting the VB behind a button, for example)????
Any help is gratefully received.... but I'm new to this Access stuff, so please assume I don't know what I'm doing!
G
Change Recordset Field Attribute Propertyy
How do you change the Long value of the Attribute property? I have a recordset that is the returning recordset from a stored procedure. I have another recordset that collects all the record. For each call to the stored procedure, the returned recordset gets appended (by AddNew and assigning each field Value) to the other recordset. For some reason, one of the Fields is set to Read-Only. It has a value of 112 in the Attribute property. I want to change it to read/write so I can assign the value of the field in the recordset that accummulates.
Change The Default Text Format Of A Field
With the following code I create some mdb files with one table and appropriate records from a recordset. How can I set some of the fields to be Number, or Date, or Currency Format and not the default Text format???
'creates the DataBase
Const lngDB_Text as Long = 10
Const intFieldLength as Integer = 100
'Create new instance of Microsoft Access
set appAccess = CreateObject("Access.Application.9")
'Open database in Microsoft Access window but invisible
appAccess.Application.Visible = false
Screen.MousePointer = vbHourglass
strFileName = strCurrentYear & strCurrentMonth & Format(CStr(ArrayID(i)), "00000") & ".mdb"
'check if exists and creates the mdb file with name = "yyyymmID"
If Dir(App.Path & "" & strFileName) <> "" then
Kill App.Path & "" & strFileName
else
appAccess.NewCurrentDatabase App.Path & "" & strFileName
End If
'get Database object variable
set objCurrentDB = appAccess.CurrentDb
'Create new table with name = "Customer"
set objCurrentTableDef = objCurrentDB.CreateTableDef("Customer")
'Create fields in new table
for j = 0 to rsCurrentCustomer.Fields.Count - 1
set CurrentField = objCurrentTableDef.CreateField(rsCurrentCustomer.Fields(j).Name, lngDB_Text, intFieldLength)
'Append Field
objCurrentTableDef.Fields.Append CurrentField
next j
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
|