Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




VB6, Entering Data Into MS Access DB, But Into A Specific Cell. Include Screenshots


Hi, my problem is that im making an application similar to a hotel management system(ive already seen source code of others on the net) but for a hospital.


Code:
If cmdOCCL1.Caption = "Occupy" Then
Set rs = Con.Execute("Insert into Ward1(RoomNo, FullName) " & _
"Values('" & 1 & "','" & txtPName1 & "')")





with this code its entering into the database table the room no which is 1 and the patients name from the txtbox.

But what i want to do is have the numbers already in the database say 1 - 20.



but the command button must add that name specifically into the row with room no. 1.


so i cant figure how to specifically add data to a specific row or cell type thing.

because say i do room 1 and the patients name goes next to room 1, then i do room 7 it will just stack one after another putting the patients name from room 7 next to room 2.

so names just stack or go in one after another.

so i'd like to figure how to put it in the specific cell or row and also how to have max room no's or rows kept at 20.


thx all help appreciated.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Entering Data Into Cell
Can somebody please tell me how to implement a simple datagrid control to input data into different cells. I dont want any connectivity to database. JUST A SIMPLE DAGAGRID STUFF. Does anyone hae any idea where can I find one or how to input data into cells.

Problem To See Specific Data In Excel Cell Via VB6
Hello all,

I have a very wierd problem.

I have an Excel file, that looks normaly

I have data in the cells. that I can see while activate the
Excell Program, can manipulate that data... like Cut paste ac..


But when I go into my VB project..
Some of the Cells I see an NULL.. its a problematic subject for me..
I tried it all...can somebody help me????/

This is the code and attach is the Excell file.
The file is Excell2000. Maybe I open the File incorrect in VB..?
Maybe Do you have some triks that I can do?

When I use the Record Count I see all Records.
When I go on F3 some of the Data apears as NULL
(For example : 18112 on its second apearence) even thou I
can see the Data on the excel program.

Thanks in Adnvace
Eran.

Here is the Code:

Public Function fOpen_ConnDBExcelFrmActive()
'Connect to the Excel DB
'Created by Rinat Sade - iDnext Ltd.

'
On Error GoTo function_error


Dim objData As New CDBData
Dim pszConnection As String
Dim pszDataBase As String
Set objCn = New ADODB.Connection
If objCn.State = adStateOpen Then
If objRs.status = 1 Then
objRs.Close
Set objRs = Nothing
End If
objCn.Close
End If

Dim glTheError As Long

'get string connection
'Paste the correct Excel File here !!
pszDataBase = frmActiveForm.txtExcelFile.Text
'glTheError = objData.fGetDBConnection(11, pszDataBase, "")
pszConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & pszDataBase & _
"; Extended Properties=""Excel 8.0;HDR=No;"""

'Open connection
objCn.Open pszConnection

Set objData = Nothing

Dim pszString As String
Set objRs = New ADODB.Recordset

If objRs.State = adStateOpen Then
objRs.Close
End If


objRs.CursorType = adOpenStatic
' Use client cursor to allow use of
' AbsolutePosition property.
objRs.CursorLocation = adUseClient


' Open the recordset
pszString = "[" & frmActiveForm.txtTable.Text & "]"


objRs.Open pszString, objCn, adOpenStatic, adLockOptimistic
Debug.Print "Number of Records : "; objRs.RecordCount
Do While Not objRs.EOF

If Len(objRs.Fields("f3").Value & "") <> 0 Then
Debug.Print objRs.Fields("f3").Value
End If
objRs.MoveNext
Loop


Exit Function
function_error:
Debug.Print err.Description, err.Number
End Function

How To Search For Data In The Worksheet By Specific Cell Name
First of all, I'd like to apologize if I post this topic in wrong forum. I'm a newbie for VB and now I got one project which has to be implemented in VB.

In my project, I've to write the program to fill in the data in specific cell name in excel spreadsheet. But until now it doesn't work

For example, I've data in range A1:C10 which I've one cell named 'Address', not the value of that cell, which I'd like to fill data in. Firstly, I specified the range in the spreadsheet by using

     Set rng = myWorksheet.Range("A1:C10")

then I wanna find where the cell named 'Address' is but I've no idea how to do it. Anybody has and idea? I tried with the command 'Find'

     Set rngFound = rng.Find(xxxxxxx, ,yyyyyy , Excel.XlLookAt.xlPart, _
        Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, _
        False)

but I don't know which parameter I'd pass to this function. Could you pls help me finding out?

Thanks in advance

Entering The Data From A Label Into Access Database
I don't think this would a particularly hard one for you guys, but I'm a noob

Basically I have a quiz program and at the end, there are 5 things which become visible/calculated

LblShowDate.Caption
LblShowTime.Caption
LblScorePercentage.Caption
ShowUsername
TopicName

ShowUsername and TopicName are global variables which just become visible at the end of the quiz, the date, time and score percentage are all worked out when the quiz has finished.

I have a table in Access called TblResults and it contains 6 fields

ResultID
Username
Topic
Date
Time
Score

As you may have guessed already, I want to enter the data from my visual basic quiz into the fields in TblResults. So far I have created the Table in Access and inserted a DataControl called DtaEnterResults.

I'm just not sure how I go about automatically inserting that stuff so it goes into the database.

Any help is appreciated thanks.

Entering Data Into Multiple Access Tables
Ok here's my problem!
I have two access tables, Machine and Component. They are connected via a one-to-many relationship(A Machine has one or more components). The primary key Machine_id in the machine table is the foreign key in the Components table.
I have a form in vb within which i wish to add one machine and then add mulitple components. I have three text boxes which show the machine details eg(name, purchase date and cost) I then have a datagrid which should be empty and allow components to be added. The proble is : i can save a machine easily but the machine_id needs to be placed into the Component table to aloow records to be added. Can anyone send me on the right track please???

Opening Excel, Selecting Book / Sheet - Read/write Data To/from Specific Cell Usinf WIN 3A
Please can someone inform me how to do the following using Win32 API functionds onlyl;

1) open excel
2) open a named bookbook and select specific sheet
3) read or write an entry into or out of a specific cell;

I have opend other programs before from a VB6 environment using shell execute statement, however in this problem I am not using VB6, rather a prorietary programming language that allows me to have access to WIN 32 API functions - so my problem has to be solved using these functions only.

Any one's help on this probelm is greatly appreciated.

Regards

adam

Activating Macros After Entering A Value In A Cell
Hello,

i wanted to ask whether it is possible to automatically activate a macro in excel after a value has been entered in a particular cell. If yes, could you please tell me how.

Example,

a user clicks cell E2 enters value 2 and presses enter and then a macro activates that inserts comment in other cell.

Thanks,
Gatis

Error Entering Textstring Into A Spreadsheet Cell
I am trying to enter the string

=TEXT((D2 - DATEVALUE("1/1/" & TEXT(D2, "yy")) + 1), "000")

into a cell on my spreadsheet.

I keep getting:

=TEXT(('D2' - DATEVALUE("1/1/" & TEXT('D2', "yy")) + 1), "000")

How can I avoid the unwanted single quotes around the cellname D2?


Code:
strTemp = "=Text((D2 - DateValue(" & Chr(34) & "1/1/" & Chr(34) & " & Text(D2, " & Chr(34) & "yy" & Chr(34) & ")) + 1), " & Chr(34) & "000" & Chr(34) & ")"
ActiveCell.FormulaR1C1 = strTemp


Code:
strTemp = "=TEXT((D2 - DATEVALUE(""1/1/"" & TEXT(D2, ""yy"")) + 1), ""000"")"
ActiveCell.FormulaR1C1 = strTemp

Msflexgrid: User Entering Text To Cell
with the msflexgrid control
how can I allow the user to enter/edit text in a cell? (like as in a textbox)
Does it have this ablility, or do I have to fudge it by putting a textbox over the cell with the focus,etc..

Exporting Specific Data From Access
Hello, and yet again i have no idea where to start with this problem...

I have been given a whole bunch of data in access. the format is like this.
col 1 = 80 customer names
col 2 = date (for themonths of may june and july)
col 3-27 = numbers...
the table is not in any particular order...

Using VBA I somehow have to create 80 worksheets in excel, each with the different customers info.

if someone could stear me in the right direction I'd really appreciate it. thanks.

Include Text In Cell Of Excel
I want to include a text into a cell of Excel. I have resize the width of a cell but i dont know how many rows must be merge vertical from that cell and below for view all the text (the text maybe has many lines). Of course after merge of cells i have set the word wrap. How to know how many cells must be merge vertical for view all the text?
Thanks

Encrypting Specific Data In Access Table
I want to save credit card number in a table.

But since this is a sensitive information, I like to encrypt the data in the table.

So, I devised following algorithm.

User will enter data only thru form.

Immediately after entering data, it will be saved in the table as garbled text (I intend to use Xor function for that).

So that if somebody opens the table directly, he won't be able to see the card number.

While viewing the data using form, it will be again shown as actual number on form using reverse algorithm.

So, my question is

In which event of the Access form I should write encryption and decryption algorithm?

Thanks for any help.

Access - Cell Data!!!!!
this is actually 2 questions all related to cells:

1) i have a field with 2 rows, when the program is run i would like the data in row 1 to equal the data in row 2 - any ideas?

2) is it possible to refer to a specific cell in a table and find its value from the visual basic editor? - so i can write something like:

Table1(Cell(Field1(4))) = "Fred" - this is just made up and doesnt work just an ex. of what i wanna do

Or if i have a query that refers to only one cell can i find what the cell value is etc?

thanks alot - all help is very much appreciated as my dam work has gotta be handed in in 7 days

How Can I Transfer Data From Excel And/or Access To A Specific Place In A Worddoc
Hi!

I've built a function for calculating some prices in Excel VBA. I get information from a access database and then I change some numbers and recieve a new price. Then add some other information and finaly save the new information in another table in the database. After this is done i would like the user to be able to click a button and then i want the program to open a word-template and adding the information that just have been saved in the table. If its possible i would like that information to be saved in a specific table in the word document.

How difficult is this?

I would at least be able to transfer the information to word.

Retrieve Specific Data From Access Database To Crystal Report
I'm a newbie with Crystal Report and VB6.

Can anyone tell me how to retrieve a specific data from access database to crystal report?

Say, I want to retrieve from table sales, where month is September.

Can anyone tell me the step by step on how to do this?

Thanks

MS Access - Reading Cell Data
sorry for yet ANOTHER access question on a ery simlilar topic but i was woundering if its possible to read the data from a cell (although ive had help to do it with with SQl) this toime i was woudering if i could do it with the visual basic editor?

The table it looks it up from only has one cell - i know theres are better ways to do this but i would prefer to do it this way so i actually 100% understand exactly whats happeing and where.

and example of how id like to us the code would be (i'll call the table 'Bob' and the Field 'Fred' )

If (CELL REFERNCE CODE) = "Hello" then msgbox "Hi"


if you seee what im actually after is how to make the referne to the cell

________________________________________________

whilst im asking for help i was also woundering what the command lie for running a macro from the VB editor in access is?

my guess would be something like:


Code:
DoCmd.OpenMacro "MacroName",
though ive got absoluptely no idea

thanks very much - after ive completed this project im definately buying an Access book - so sae asking all you guys how to do simple stuff - well i presume its simple

thanks again

Append Data To A Certain Cell In A Access DB Table
Hi,

I am making a program that connects to access and it keeps a record each day of how many times you clicked a certain command button. My problem I am having is that I don't know how to write to a certain row on the table. Would you tell what cell you write to in your append query? my append query currently has:

INSERT INTO Table1 ( Software )
Values ([@Software];

Here is what I have when I click on the button:

Code:
Private Sub cmdSoftware_Click()
Const strQuery_Name = "AppendSoftware" ' The Append Query
Const strQuery_Parameter_Name = "Software" ' The column I am going to append to
Dim cmd As ADODB.Command: Set cmd = New ADODB.Command
Dim prm As ADODB.Parameter
Dim softcount As Integer

If DataGrid.TextMatrix(Datagrid.rows - 1, 2) = "" Then softcount = 0 ' checks if there is a number in that field
' Datagrid is a MSHFLEXGRID on my form that displays the data

softcount = softcount + 1 ' softcount is the integer that will keep track
                    ' of how many times the user clicks this button

With cmd
    .ActiveConnection = cnConnection
    Set prm = .CreateParameter(strQuery_Parameter_Name _
                                , adVarChar _
                                , adParamInput _
                                , Len(softcount) _
                                , softcount _
                                )
    Call .Parameters.Append(prm)
    .CommandType = adCmdStoredProc
    .CommandText = "AppendSoftware"
    .Execute
End With
rsRecordSet.Requery
Set DataGrid.Recordset = rsRecordSet

End Sub


Currently, when this code is executed it appends in a new row each time and I need it to append in the same row. Can anyone help me, Please?

Thanks,
Computergeek89

How To Access A Specific Link On A Specific Frame With WebBrowser Control?
Using WebBrowser control(or equivalent code) I want to access science.cgi from the side frame of a page with this source code:

Main Page:

Code:<HTML><HEAD><TITLE>The World of Legends</TITLE></HEAD>
<FRAMESET COLS=100,*>
<FRAME NAME=links SRC="links/side.htm?rc=467228" MARGINWIDTH=0 MARGINHEIGHT=0>
<FRAMESET ROWS=25,*>
<FRAMESET COLS=*,275>
<FRAME NAME=freebies SRC="links/top.htm?rc=283268" NORESIZE MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO>
<FRAME NAME=adlink SRC="http://misc.swirve.com/adframe.cgi?server=u1.swirve.com&cid=1" NORESIZE MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO>
</FRAMESET>
<FRAME NAME=utomain SRC="menu.cgi?entergame=yes&ad=true&rc=6754842" NORESIZE MARGINWIDTH=0 MARGINHEIGHT=0>
</FRAMESET>
<NOFRAMES>Utopia requires a frames-capable browser. Almost every
modern browser includes frame support, so you may wish to try upgrading
to a browser such as Netscape or Internet Explorer.</NOFRAMES></FRAMESET>
Utopia requires a frames-capable browser. Almost every modern browser
includes frame support, so you may wish to try upgrading to a browser
such as Netscape or Internet Explorer.
</BODY></HTML>


Side Frame:

Code:<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR=#000000 TEXT=#FFFFFF LINK=#FFFFFF VLINK=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<IMG SRC="http://207.200.11.37/utopia/gr/uttitle.gif" WIDTH=80 HEIGHT=30 BORDER=0><FONT SIZE=-1>
<MAP NAME=menu>
<AREA SHAPE=rect TARGET=utomain HREF="/menu.cgi?" COORDS=1,3,80,15>
<AREA SHAPE=rect TARGET=utomain HREF="/council.cgi?" COORDS=1,16,80,28>
<AREA SHAPE=rect TARGET=utomain HREF="/explore.cgi?" COORDS=1,42,80,54>
<AREA SHAPE=rect TARGET=utomain HREF="/build.cgi?" COORDS=1,55,80,67>
<AREA SHAPE=rect TARGET=utomain HREF="/science.cgi?" COORDS=1,68,80,80>
<AREA SHAPE=rect TARGET=utomain HREF="/military.cgi?" COORDS=1,81,80,93>
<AREA SHAPE=rect TARGET=utomain HREF="/magic.cgi?" COORDS=1,107,80,119>
<AREA SHAPE=rect TARGET=utomain HREF="/thievery.cgi?" COORDS=1,120,80,132>
<AREA SHAPE=rect TARGET=utomain HREF="/attack.cgi?" COORDS=1,133,80,145>
<AREA SHAPE=rect TARGET=utomain HREF="/aid.cgi?" COORDS=1,146,80,158>
<AREA SHAPE=rect TARGET=utomain HREF="/readmsg.cgi?" COORDS=1,172,80,184>
<AREA SHAPE=rect TARGET=utomain HREF="/msg.cgi?" COORDS=1,185,80,197>
<AREA SHAPE=rect TARGET=utomain HREF="/forum.cgi?" COORDS=1,198,80,210>
<AREA SHAPE=rect TARGET=utomain HREF="/politics.cgi?" COORDS=1,211,80,223>
<AREA SHAPE=rect TARGET=utomain HREF="/status.cgi?" COORDS=1,224,80,236>
<AREA SHAPE=rect TARGET=utomain HREF="/scores.cgi?" COORDS=1,250,80,262>
<AREA SHAPE=rect TARGET=utomain HREF="/leaders.cgi?" COORDS=1,263,80,275>
<AREA SHAPE=rect TARGET=utomain HREF="/news.cgi?" COORDS=1,276,80,288>
<AREA SHAPE=rect TARGET=utomain HREF="/news.cgi?yesterday=true?" COORDS=1,289,80,301>
<AREA SHAPE=rect TARGET=utomain HREF="/dragon.cgi?" COORDS=1,302,80,314>
<AREA SHAPE=rect TARGET=utomain HREF="/pref.cgi?" COORDS=1,328,80,340>
<AREA SHAPE=rect TARGET=_blank HREF="http://games.swirve.com/utopia/help" COORDS=1,341,80,353>
<AREA SHAPE=rect TARGET=utomain HREF="http://games.swirve.com/utopia/help/faq.htm" COORDS=1,354,80,366>
<AREA SHAPE=rect TARGET=_top HREF="/logout.cgi?" COORDS=1,370,80,385>
</MAP>
<CENTER><IMG SRC="http://207.200.11.37/utopia/gr/newmenu.gif" USEMAP="#menu" HEIGHT=385 WIDTH=80 BORDER=0>
<a href="sidenogr.htm"><font size=1 face=verdana><B>No Graphics</B></FONT></A>
</BODY></HTML>


It must be accessed from the site, since it gives me a "You cannot access this page from outside the site" error.
However, I can click the last link of the side frame to open a page with this source:

Code:<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR=#000000 TEXT=#FFFFFF LINK=#FFFFFF VLINK=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<IMG SRC="http://games.swirve.com/utopia/gr/uttitle.gif" WIDTH=80 HEIGHT=30 BORDER=0><FONT SIZE=-1>
<FONT SIZE=1 face=verdana>
<BR>
<A HREF="/menu.cgi?" TARGET=utomain>Menu</A><BR>
<A HREF="/council.cgi?" TARGET=utomain>Council</A><BR>
<BR>
<A HREF="/explore.cgi?" TARGET=utomain>Explore</A><BR>
<A HREF="/build.cgi?" TARGET=utomain>Growth</A><BR>
<A HREF="/science.cgi?" TARGET=utomain>Sciences</A><BR>
<A HREF="/military.cgi?" TARGET=utomain>Military</A><BR>
<BR>
<A HREF="/magic.cgi?" TARGET=utomain>Mystics</A><BR>
<A HREF="/thievery.cgi?" TARGET=utomain>Thievery</A><BR>
<A HREF="/attack.cgi?" TARGET=utomain>War Room</A><BR>
<A HREF="/aid.cgi?" TARGET=utomain>Send Aid</A><BR>
<BR>
<A HREF="/readmsg.cgi?" TARGET=utomain>Read Msgs</A><BR>
<A HREF="/msg.cgi?" TARGET=utomain>Send Msgs</A><BR>
<A HREF="/forum.cgi?" TARGET=utomain>Forums</A><BR>
<A HREF="/politics.cgi?" TARGET=utomain>Politics</A><BR>
<A HREF="/status.cgi?" TARGET=utomain>Relations</A><BR>
<A HREF="/dragon.cgi?" TARGET=utomain>Dragons</A><BR>
<BR>
<A HREF="/scores.cgi?" TARGET=utomain>The Kingdom</A><BR>
<A HREF="/leaders.cgi?" TARGET=utomain>The World</A><BR>
<A HREF="/news.cgi?" TARGET=utomain>The Paper</A><BR>
<A HREF="/news.cgi?yesterday=true?rc=978902?" TARGET=utomain>Last Month</A><BR>
<BR>
<A HREF="/dragon.cgi?" TARGET=utomain>Dragons</A><BR>
<A HREF="/defect.cgi?" TARGET=utomain>Defect</A><BR>
<A HREF="/pref.cgi?" TARGET=utomain>Preferences</A><BR>

<A HREF="/logout.cgi?" TARGET=_top>Log Out</A><BR>
<A HREF="side.htm?">Graphics On</A><BR>
</BODY></HTML>


The code I have been using so far in my program(for filling text boxes) looks like this:

Code:Private Sub Com1_Action()

Dim htmlSearchButton As HTMLButtonElement

Set docCurrentHTML = WebBrowser1.document.documentElement.All

For Each Item In docCurrentHTML

If Item.tagName = "INPUT" Then
If Item.Name = "Username" Then
Item.Value = Text1.Text
Exit For
End If
End If

Next Item

Any help would be nice!

Save Pictures / Screenshots (bitmaps And Jpegs) In A Access Database
hi all
im working with a ms access 2003 database and vba
what i need to do is to save pictures / screenshots (bitmaps and jpegs) in the database
first i would need to save these to a array though (because application specific) and then save them into a database
does somebody know how i can save them in a array and database?
thanks a real lot


How Do I Get VB To Go To The Last Cell, Not A Specific Cell
sorry guys, im sure this isnt rocket science to you, but this is driving me mad!

The below is a section of code im writing, but the basic principal i am trying to achieve is to go to the bottom of a list of data and then autosum. The thing is i dont want it to use a specific cell, as the amount of data in the column will change.

What am i doing wrong?

Columns("K:K").Select
Selection.FindNext(After:=ActiveCell).Activate
Columns("K:K").Select
Range("K100").Activate
ActiveCell.FormulaR1C1 = "=SUM(R[-98]C:R[-1]C)"
Columns("K:K").Select
Range("K100").Activate


Thanks Dom

Find The Last Cell In A Col With A Specific Value
Hi all,

say I have a list of values in a Column in a worksheet that looks something like:

Blah
Rhubarb

Twaddle
07981
07944
07866
Drivel

Fluff

Does anyone know a quick way to find the ROW NUMBER of the last value that starts 079? Obviously I can loop and stuff, but I was wondering if there was some in-built function that would do this. I have to do this sort of test many times, and looping and testing all the cells seems like a good way to slow this thing to a crawl.

Cheers in advance
J.

Value Of Specific Cell In DataGrid
Hi!
i am displaying data in a DataGrid. In Click()event i want to get the column(0).value, column(1).value and column(3).value in to variables , of that row. Then i have to open a recordset, these 3 variables as parameters.

Code:Private Sub grdDataGrid_Click()
Dim sCurAccType$, sCurTaxType$, sStatus$
Set rsShowDetails = New ADODB.Recordset
sCurAccType = grdDataGrid.Columns(0).Text 'Account_Type
sCurTaxType = grdDataGrid.Columns(1).Text 'Tax_Type
sStatus = grdDataGrid.Columns(3).Text 'Status
rsShowDetails.Open ("SELECT * FROM tbl_TransDetails WHERE Account_Type = '" & sCurAccType & "'" _
                    & " AND Tax_Type= '" & sCurTaxType & "'" _
                    & " AND Status = '" & sStatus & "'" _
     & " AND Entry_Date = #" & cmbEntryDate.text & " # " )
Me.Hide
Show frmShowDetails
End Sub
I tried with the above code. It is getting values, but with the first row of data. but i want to get values of the row i clicked. Please help me.
Thanks!
>>>>>>>>>>>>>>



Edited by - sreddy on 3/22/2005 8:04:45 AM

Entering Data Into A Pop Up Box
hi,
i tried to open a webpage using my vb program...........it is prompting for username and password.......how wud i be able to get the window handle and enter username and password into it and click ok button?

thanks

regards
vivek.s

Entering Data
Hi!

I'd like to know how I can enable the user to enter data in an access-like or excel-like way. I'd like the user to enter a product-subscription, Prize, number of products to order and some other data. This has to be presented in a column-like way.

Product Prize No. Total
Product A 100.00 5 500.00
Product B 150.00 4 600.00
etc..

What I want is something like the DB grid to enter the data.
I DON'T like 3rd party controls or OCX-es, so what is the best solution?

(An array of textboxes is an option, but I'd like to know what you all think of it). As far as I know the DBGrid and all other controls are read-only if they're not connected to a database?

Run Macro On Specific Cell Change
Is there a way to have a VB Macro run when a specific cell changes value ? I am able to have a macro run when a "sheet data change" takes place, but do not know how to isolate a specific cell to be watched, while ignoring any other changes to the sheet.

Thanks in advance for any help !!!

Select Specific Cell Range
Microsoft Excel 2003
Microsoft Visual Basic 6.3


Hello,

I am trying to make my macro select a range of cells whose row numbers are calculated within the macro.

Unfortunately the method I used doesn't seem to work, it tells me there is a 'Run time error 1004' and the debugger goes to the offending line (the second line of code shown below).

I originally recorded the macro, and then edited it to be able to automatically select a different range.
I originally had:


Range("B34:B37").select

And changed it to:

Range("B[(p + 1) - (r - 1)]:B[p + 1]").select

p & r are both defined beforehand and set equal to numeric values which depend on certain other factors.
This is probably a ridiculous way of going about it and I know very little about programming, but if anyone knows the correct way then I could REALLY use some help.

Thanks,

Henry

To Copy Specific Cell From 2 Workbook
Hi,

I would like to copy specific cell data from 2 workbook to another workbook(which is already existing).I am using VBA for excel. I would like to have the commands button only on the first workbook, without opening the 2nd and 3rd workbook. Can i fetch a cell data from 2nd workbook and write to the 3rd workbook.
Thanks in advance.

How To Pick Value From A Specific Cell In DataGrid
hi dears

how can i pick value of a specific cell from a datagrid.

thanx in adavance

tariq

SetFocus In Specific DataGrid Cell
How do I specify A datagrid cell
I have the column and row numbers
Just cant figure out correct syntax to place the cursor

How To Set Focus To Specific Cell In A Datagrid?
Hello brainy people,

I love this place because there are so many brainier people than me here. I can usually find answers to my insignificant little problems with a simple search. But this time I need to post.

I have a datagrid (datagrid1) on my form which is linked to an ADO recordset (rsProductCosts). To validate the data entered by the client I use the sub Datagrid1_Validate to loop through the recordset and check that each required column has been completed and it's contents confirm to the required datatype. The point at which I am having a problem is passing focus back to the relevant cell of datagrid1 when the data doesn't pass validation. The validate method automatically returns focus to the datagrid but not to the cell which requires action by the client. I have tried the following;

rsProductCosts.AbsolutePosition = currentrow
DataGrid1.col = currentcol

but I can't seem to get it to work. Is it even possible.

Regards
JohnFromPerth

Accessing A Specific Cell In A DataGrid?
Hi,
I have a datagrid hooked up to a MySQL database. I was wondering how I can access a specific row, column, or cell. For example, say I have 3 columns (id, name, and age) and 2 rows. If I wanted to get the name located in Row 2 Column 2, and set the caption of a label in my form to this name in Row 2 Column 2, how do I do it?

Thanks!

How To Set The Value To Specific Cell In DataGrid By Programmin?
I use VB 6 to implement project codes which use Datagrid to present information from database. The Datagrid allows user to modify, delete and add information and under some events I want to set value in specific cell by code such as at cell of first column and third row. How to do it? Thanks!

Add Data To A Specific Field From Specific Record
what's the part i'm missing or doing wrong! can you have a look?
thank's


Dim LOTeliminA As String
LOTeliminA = "SELECT TAULA_BASE.*, IDENTIFICADOR AS expr1 FROM TAULA_BASE where ( IDENTIFICADOR = '" & CBOaNULARlOTS.Text & "')"

Dim CONEXioLOTeliminA As ADODB.Connection
Set CONEXioLOTeliminA = New ADODB.Connection
CONEXioLOTeliminA.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "Porci_Lots.mdb;" & "Persist Security Info=False"

Dim recordSetLotElimina As ADODB.Recordset
Set recordSetLotElimina = New ADODB.Recordset
recordSetLotElimina.CursorLocation = adUseClient
recordSetLotElimina.Open LOTeliminA, CONEXioLOTeliminA, adOpenKeyset, adLockOptimistic '


With recordSetLotElimina
'.AddNew
.Fields("motiu_baixa") = Me.TXTmotiuBaixa.Text
'.Update
End With

Set recordSetLotElimina = Nothing
Set CONEXioLOTeliminA = Nothing

How To Export A Db From A Sql 7 (include Data And Data Structure To A File? I Want To Copy A Db From
How to export a db from a sql 7 (include data and data structure to a file? I want to copy a db from live sql 7 db to my laptop's sql server 7 for testing. thanks

Entering Data Into Two Tables
I have a Form that has several text boxes tied to the database for input from the user. If it is a special order than I need to put it in another table. In a check box I have the option. So let's say if:

If Check's Value = True

If [CHECK] = True Then ????

What would be the code to tie this into another table? It would be maybe just four different text boxes. text1, text2, text3, text4.

Any help is appreciated! thanks...a million

Stephen

Entering Data Without The Enter Key
I am designing a very simple form in MS Access for entering 2 pieces of data onto each record of a table. So this form has 2 textBoxes.

99% of the source data are labels with bar-codes. When the operator uses a barcode scanner to enter the data, he scans the 1st data onto textbox1, press the "enter key" on his keyboard, the cursor jumps to textbox2. He scans the 2nd piece of data onto textbox2, press "pagedown" key on the keyboard and start data entry for the next record. No problems so far.

Because the length of the 1st and 2nd field are FIXED, the operator wants me to use VBA programming to eliminate his needs of pressing the "enter" key & the "pagedown" key? At this moment I am planning of using the "keydown" event, the gotoControl method, gotoRecord method, plus some counters to handle this requirements.

Before I set out to do the above programming, do I have a simpler approach? As usual, all suggestions would be much appreciated.

Entering Data Into Hflexgrid
How do I set a Hierarchical Flex Grid so that you can type data in the cells?

Entering Data To A New Form
hi,

could someone please tell me how to input data from one form to another when an event is triggered.

thanks wullb

Entering Data To Datagrid..help
Hi,
I am taking in information in a form(actually a form of calculator) and am storing all the calculations in an array. I want to retrieve this data and place in to a datagrid control(or other appropriate control) so that it is laid in a readable manner no matter the size of the figures I get. I have tried to use a datgrid but I can only see that a datasource for this control is from a database, dataset etc. Any help would be greatly appreciated.. I am a newcomer to vb.

Entering Data Into Webforms
Hello,

I am hoping someone can help. I am trying to enter a file path into a form on a website. Here is the portion of the form that contains the relevant data:

Code:
<form name="frmImageUpload" method="post" action="img_upload.aspx?fid=-1" id="frmImageUpload" enctype="multipart/form-data" __smartNavEnabled="true">

...other misc form stuff...

<td class="lblno">Find File:
<br>
<input name="m_fFile1" id="m_fFile1" type="file" size="30" />
</td>
Now I have tried all of the following but none of these options will enter the desired value into the input box.


Code:

IE.document.all("m_fFile" & b).Value = img_lst(a) ' b is a variable telling which m_fFile to enter data into IE m_fFile1

IE.document.Forms("frmImageUpload").element("m_fFile" & b).innerText = img_lst(a)
IE.document.Forms("frmImageUpload").element("m_fFile" & b).innerHTML = img_lst(a)
IE.document.Forms("frmImageUpload").Items("m_fFile" & b).Value = img_lst(a)
IE.document.Forms("frmImageUpload").element("m_fFile" & b).Text = img_lst(a)
Any help would greatly be appreciated!

Problem With Entering Data.....
I have a datagrid and an adodc object on my form.

The user can type in a number in a text box, click a cell on
the datagrid and hit an "Enter Data" button, and the data
they typed in will be entered into the cell they clicked.

Problem is I am getting an error message as follows:

"Insufficient or Incorrect key column information: too many rows
affected by update"

Then a run time error message box comes up:

"The change was canceled during notification, no columns are changed"

Then another error message when I hit "End" :

"The specifies row could not be located for updating, some
values may have been changed since it was last read"


Why am I getting these messages? And how can I fix it so the
data is entered correctly?

Here is the code I have:


---------------------------------------------------------------

Private Sub Command4_Click()
Dim toEnter As Variant
toEnter = Text1.Text
If IsNumeric(toEnter) = True Then

'Dim ColNumber As Integer, RowNumber As Integer
RowNumber = DataGrid1.Row
ColNumber = DataGrid1.Col


If ColNumber <> "2" Then
MsgBox "Please Select A Result Cell to Enter the Result into ", vbInformation
Else

DataGrid1.Text = toEnter


If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MovePrevious
Else: Adodc1.Recordset.MoveNext
End If
End If
Else: MsgBox "You Must Enter a Numeric Result", vbInformation
End If

End Sub

-------------------------------------------------------------------

Entering Data Into An Array
I have to enter data into an array using two text boxes and one combo box. Once I intialize my array, what is the proper syntax to enter this data into a multi dim array? It has to be 14 rows with 3 columns.

thanks,

Troy

Entering Data In Excel
Hi people

It's been a while but now I could use some more help. I think it is similiar to my last
project. My first one was I had 22 numbers which could be any number 1-80,when the vb program reads it, the program would open a workbook in Excel and enter "1" in the correct row example: 1, 4,67,70,80..... was in text3.txt then in the third column(C) it would put a "1" in C1,C4,C67,C70,C80..... The program worked perfectly. Now my new problem is my data changed, my new numbers will always be 0-9 part A of the problem is make 0 = 10 so it will be installed in A10, B10, or where-ever. part B is I still need a "1" installed as in my first project, but my numbers can now be repeated such as 2289 or 0000 or 1234, so if text3.txt = 1234 then "1" would be installed C1,C2,C3,C4. How ever if text3.txt = 0034 then excel sheet needs to record this, C10"2",C3"1" C4"1" and once more. if text3.txt = 7777 then C7 would ="4" I hope this makes sense It's a real problem with somebody "with Learn VB in 21 days book"

Im pasting the code from my first project to see if it can be amended

thanks in advance

lneilson

 

Start a new standard exe project, include a reference to the excel object libraries
(Project menu -> References, scoll down and put a check next to "Microsoft Excel <version>
Object Library"). Put a command button (Command1) on the fprm. paste this code into the
General Declarations section of the form.

Code:Option Explicit

Private Sub Command1_Click()

'declare and instanciate excel application object
Dim objExcel As New Excel.Application

'declare workbook and worksheet objects
Dim objWorkBook As Excel.Workbook
Dim objWorkSheet As Excel.Worksheet

Dim lFileNum As Long
Dim loop1 As Long
Dim strInRec As String
Dim strInFields() As String

Dim strFullPath As String
Dim strFileName As String
Dim lColumnNum As Long

'prompt for the file
strFullPath = InputBox("Please enter The Full path to the file")

'check that the file exists
If Dir(strFullPath) = "" Then
    MsgBox "File does not exist"
    'destroy the excell object
    Set objExcel = Nothing
    'exit this sub
    Exit Sub
End If

'get just the filename portion of the path
strFileName = Split(strFullPath, "")(UBound(Split(strFullPath, ""), 1))

' strip off the leftmost 4 chars of the file name
' if the file name was "text3.txt" then what is left is "3.txt"
strFileName = Right(strFileName, Len(strFileName) - 4)
'get the column number' the val function returns the numeric value of a string,
'only taking into coinsideration the numbers at the start up to an not including
'the first num-numeric character. to follow the previou example,
'lColumnNum now equals 3
lColumnNum = Val(strFileName)

'check the the column number is valid
If lColumnNum < 1 Then
    MsgBox "invalid column number"
    'destroy the excell object
    Set objExcel = Nothing
    'exit this sub
    Exit Sub
End If

'open or create new workbook
If Dir("c:MyTestExcelFile.xls") = "" Then
    Set objWorkBook = objExcel.Workbooks.Add
Else
    Set objWorkBook = objExcel.Workbooks.Open("c:MyTestExcelFile.xls")
End If

'get first worksheet
Set objWorkSheet = objWorkBook.Worksheets(1)

'get next available file num
lFileNum = FreeFile

'open file
Open strFullPath For Input As #lFileNum
  
 'read first line
Line Input #lFileNum, strInRec

'close file
Close #lFileNum

'split line into the InFields array by the comma delimiter
strInFields = Split(strInRec, ",")

'loop through the returned fields strInFields is a 0 based array
For loop1 = 0 To UBound(strInFields, 1)
    'set the cell at the position indicated in the file to 1
    objWorkSheet.Cells(CLng(strInFields(loop1)), lColumnNum) = 1
Next loop1

' close and save the worksheet
objWorkBook.Close True, "c:MyTestExcelFile.xls"
'quit excel
objExcel.Quit

'destroy the objects
Set objWorkSheet = Nothing
Set objWorkBook = Nothing
Set objExcel = Nothing
End Sub





Edited by - lneilson on 7/16/2002 11:09:50 AM

Set Background Color In Specific Cell (Msflexgrid)
Hi,

This is an urgent request for help.
May i know how to set the background color to specific cells in msflexgrid?

thanks a million!

** RESOLVED ** Boldface Specific Cell In Flexgrid. Possible ?
Can anyone tell me what combination of .Cell, .Row, .Rowsel, .Colsel I ned to boldface a specific cell i a flexgrid ?

Ideally I would like to boldface specific rows.

I know it can be done, I just haven't hit the right combination yet, and its doing my head in

Insert Information Into A Specific Datagrid Cell
I am using a datagrid connected to an SQL server via an ADO connection.

I need to be able to insert a value into a hidden datagrid field via code. How can I do this?

Example:

I am displaying the data in a datagrid. I have set the visibility of the Payrate field to false, for security purposes. Now what I want to happen via code. When the user adds a record to the datagrid they enter the machine number in it's cell. I will use an SQL statment to get the payrate for that particular machine. (I can get this to work). Now for the real problem. How can I set the payrate cell in the added record to the payrate for that machine number.

If this is not clear e-mail me or post any questions you have of me.

If anyone can help with this... I thank YOU.

How Can You Select A Cell In A Specific Sheet To See If It Holds Any V
can you select a cell in a specific sheet to see if it holds any value an dthen display it in another sheet and or word document

Entering A Date Into An Access Database?
Effectively, my program is trying to use the following line to insert a record into the database - it works fine accepts for the sTime and corresponding value. I assume this is due to the fact that I am not entering the data in the correct format for a date/time field set to Medium Time as its data format

Connec.Execute "INSERT INTO tblIncident (Incident_Num,IsClinical,sDay,sMonth,sYear,Duration,Setting,sTime) VALUES(2312,Yes,'12','12','1999',213,'213','12:12 AM')"

a little help would be appreciated

Need Help With Data Entering In Real Time
I have next situation>

Another program make a .txt file with format like this

(first line) Some information
(second line) Some information
(third line) Some information
(4th line) time data1 data2 data3 data4 data5 data6
(5th line) time data1 data2 data3 data4 data5 data6
....

That programm every second add few line of data!

I need to read that data and show on the screen like numbers and like line chart in real time.

Also I need to have some options to analyze that all data later on. When first program finishid with updateing .data file!!

ANY HELP...

THANKS A LOT

Copyright © 2005-08 www.BigResource.com, All rights reserved