Trying To Stop Moving Past Last Record
I am writing a database with a number of tables with forms atttached to each table. I have placed navigation buttons on each form to move to first, last, next, previous. I have set up the code associated with the buttons as "public sub" so it is available for each form to use.
This was working OK except that when I used the NEXT button at the last record it would open a new blank record & keep opening a new blnak record on each click.
To over overcome this I put in an If statement to check if it had moved to a new record. To do this I used the following:
If Me!NewRecord Then ..... etc
Now I get an error "Invalid use of Me key word" I suspect it is because I am using ME in a public sub
How do I overcome the problem of moving passed the last record and still have the coding available to all forms?
The Code is below.
Thnaks for any help.
Public Sub Next_Record_Click() On Error GoTo Err_Next_Record_Click
DoCmd.GoToRecord , , acNext
If Me!NewRecord Then ' If new record move back to previous DoCmd.GoToRecord , , acNext ' Send message MsgBox "This is the last record", , "No More Records" End If
Exit_Next_Record_Click: Exit Sub
Err_Next_Record_Click: MsgBox Err.Description Resume Exit_Next_Record_Click End Sub
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Record Past Results
Hey,
i have a small game made in vb, i want the scores to be added to a list "Past Scores", the problem is i dont know how i can record the scores in a way that they will be there next time the program is open. i know databases is one way but is there any other similar way to record the scores? (i have not learnt databases yet so if you post code on that please give me a link to a good tutorial or explain it a little, shouldnt take much i catch on quick )
Thanks
lee
Form Navigation Past Deleted Record Question
How can I navigate past deleted records via Form? I am utilizing DAO 3.6 in Access 2002. Currently my form shows #Deleted in each field of the form when I navigate using the default form navigation. I would appreciate any help.
Flint
PS Yes, I have searched this forum and the MSDN Library so don't flame me.
Stop Txt Moving
can any1 tell me how u stop txt that is in side a pic box moving ever thing u click in the box
Pic Box, Object To Stop Moving
what im trying to do is make it so that i have one bit picture box and a pong design interface inside it(this is a final assignment im making a variation of pong) anywho what im trying to do(and tryed everything i've thought of) is to get it so that when you drag the padel down it cannot pass the line at the top or the bottom, and both these lines are drawn, not made at runtime. thanks for help
also after you hit the line you cannot go down or up further then the line, and you can continue moving inside the two lines
Trying To Stop A Form Moving
hi, i am making a program that has docking forms onto the main mdi form. I am trying to make it so that the forms can be docked and undocked. I have so far made a timer that keeps a form in its position all the time but when the user tries to drag the form it flashes and such and then returns to the position wheras i don't want it to move at all, is there any way i can subclass it to stop it moving?
How Do I Make A Shape Stop Moving?
I have a shape(Shape1) that you can move with the arrow keys....how do i make the Shape1 cease to move when a certain event happens, even though the arrow keys are still pressed?
thanks for any help!
ListView - Stop Icons Moving
Hi,
I'm using a listview control in the Icon mode, to display a control panel for my application. The only problem is that when a user clicks an icon, when you move the mouse it moves the icon as well.
Is there any way to stop the user moving the icon?
Stop Maximized Form From Moving
I am using a picturebox as a container to act as a mdiparent because only 1 midparent is allowed when I need 2. When I maximize a "child" form, the title bar is still visible which enable the user to move the max form. I get an error when I set moveable=false during runtime. Is there any way to stop the maxed form from moving? Thanks.
How Do I Stop Flickering In Moving Graphics?
I haven't dealt with graphics in vb before, but I know of a common graphics method to reduce/eliminate flicker in animations called double-buffering.
The flicker is caused from clearing the old frame before drawing the new one. To counter this problem you actually would have 2 picture boxes (or whatever you're using) the first one is the visible one that will display the animation. On the second buffer, you do the calculations for the next frame and place all the objects there, then once the frame is ready for display you change the image on the visible buffer to that of the second buffer.
Since I haven't done this in vb before I'm not to helpful in the code department, but hopefully you'll find this method usefull.
Stop User Moving The Chart Around In MsChart
VB6 SP6
I am using MsChart. I need to allow selections but when this is set to True users can click on the chart and move the plot area around the unplotted area.
Anybody know a way to avoid this
Thanks
Stop Item Dragging/moving In ListView
Is there any way you can stop the user from moving the item position in a listview?? I need them to stay the same as i added them first by code, with them being fixed for the user and not allowing any movement of item position!
thanks!
Stop A Moving Image Drawing Over Other Lines...
I have the following code which moves a little image control across the form, but what happens when it moves across slowly is it sort of half draws over lines that I have on the form....how can i get it so that it doesnt draw over the other lines and leaves them intact....so that it doesnt leave this kind of trail.....
VB Code:
Private Sub Timer1_Timer()If Image2.Left < 9240 Then Image2.Left = Image2.Left + 1'only move the picture one space over if it isnt alreadt at the desired locationEnd IfEnd Sub
How To Stop Cursor Keys Moving Focus ?
I am writing a program where an object can be moved round the screen. I first did this using command buttons and then wanted to add the option of using the keyboard cursor keys.
KeyAscii and/or KeyCode worked for most keys but not the cursor keys which didn't seem to generate any events. I got something working using an API call (GetAsyncKeyState).
The bit which still bugs me is that when the user presses the cursor keys, as well as moving the on-screen object, it also moves focus round the various command buttons.
Can anyone suggest how to stop this happening ?
Making A Label Stop Moving When It Hits A Certain Point[solved]
I have a long Label, it shows text, I want it to scroll slowly, but how do I make it stop at a certain point, If I do
VB Code:
Private Sub tmrAbout2_Timer() DoEvents LblAbout.Top = LblAbout.Top - 10 DoEventsIf LblAbout.Top <= 0 Then tmrAbout2.Enabled = FalseEnd Sub
Then it stops when the top of the label hits the top of the form/frame, I want it to scroll through the top of the frame, Its fine if I dont put an If then but it keeps going forever.
Stop A Record Count
Hi Guys,
Question for ya.
I want to stop the database to add new records and start with a new batch. My recordset is comprised of 831 entries.
I want it to start from the begining with record number to read 04001 as in year 2004, record 001, instead of just 831.
this is the code i have:
Private Sub cmdNew_Click()
Data1.Recordset.AddNew
' This generates the next Order Number * RAP
Dim OrderNumber As Integer
OrderNumber = (Data1.Recordset.RecordCount + 1)
TxtOrderNumber2004 = OrderNumber
txtOrderDate = DateTime.Date
End Sub
Anything will be appreciated
Thanks
Moving To Record
I have a control on my form that copies the contents of a form and a subform to a new record. Here is my code. On my form, how do I find the new record? That is to say, once I copy the record, the "old record" is still the one on my form. I want to move to the "new record" as part of the copy function.
'copy record to new Quote record
intQuoteID = Forms![Bid - Master Form]![Bid - Quote]![Quote ID]
Set dbs = CurrentDb
Set rstQuote = dbs.OpenRecordset("Bid - Quote")
rstQuote.AddNew
intNewQuoteID = rstQuote![Quote ID]
Debug.Print "New Quote ID " & intNewQuoteID
Debug.Print "New Quote ID " & rstQuote![Quote ID]
Debug.Print "Old Quote ID " & intQuoteID
rstQuote![Master Bid ID] = Forms![Bid - Master Form]![Master Project ID]
rstQuote![Other Mfr] = Forms![Bid - Master Form]![Bid - Quote]![Other Mfr]
rstQuote![Comments] = Forms![Bid - Master Form]![Bid - Quote]![Comments]
rstQuote.Update
Forms![Bid - Master Form]![Bid - Quote].Requery
'copy quote items to new quote items records
strSQL = "Select * " & _
"FROM [Bid - Quote Items] " & _
"WHERE [Quote ID] = " & intQuoteID
Set rstOldQuoteItem = dbs.OpenRecordset(strSQL)
Set rstNewQuoteItem = dbs.OpenRecordset("Bid - Quote Items")
Do While Not rstOldQuoteItem.EOF
rstNewQuoteItem.AddNew
rstNewQuoteItem![Quote ID] = intNewQuoteID
Debug.Print "New Quote ID " & rstNewQuoteItem![Quote ID]
rstNewQuoteItem![Quantity] = rstOldQuoteItem![Quantity]
Debug.Print "Qty " & rstOldQuoteItem![Quantity]
rstNewQuoteItem![Description] = rstOldQuoteItem![Description]
Debug.Print "Description " & rstNewQuoteItem![Description]
rstNewQuoteItem![Finish] = rstOldQuoteItem![Finish]
rstNewQuoteItem![Price] = rstOldQuoteItem![Price]
rstNewQuoteItem![Comments] = rstOldQuoteItem![Comments]
Debug.Print "Comment " & rstNewQuoteItem![Comments]
rstNewQuoteItem.Update
rstOldQuoteItem.MoveNext
Loop
Forms![Bid - Master Form]![Bid - Quote]![Bid - Quote Items]
Thanks is advance
Scott
Moving A Record
Hello Guys,
Im using a control called Adodc i was woundering if anyone can tell me how to move a record from tblName to tblSecondName with a click of a command button.
I use the followind code to save a record.?
vb Code Code:
If MsgBox("Are you sure you want to save the record?", vbQuestion + vbYesNo, "Saving...") = vbYes Then
Adodc2.Recordset.Fields("Subject") = cbosub.Text
Adodc2.Recordset.Update
distext
End If
Moving To A Record
I have a many side of a relationship in a table.
So ive created a form etc etc. Say Im looking at record #1
for simplicity lets say its an orders form with an order-details within it. Im looking at record 1 and it shows that it has 40 order details. I have a next / previous button and a first last button. What if I wanted to go to order detail #30 Id have to either keep pressing up or press first once and move down to 30. I dont want this. I want a text box that a user can enter the record they want to look at and it moves directly to it on hitting the enter key.
How do I do this via ADO?
Jon
Moving To The Next Record Ms Sql & Vb
Hi, im kinda new to working with vb and sql server, i need to be able to scroll through records but i have no idea how. As of right now my code is:
CODEDim cn As ADODB.Connection
Dim RS As ADODB.Recordset
Dim strSQL As String
Set cn = New ADODB.Connection
Set RS = New ADODB.Recordset
cn.Open "Driver={SQL Server};Server=server;Database=mydata;uid=;password='';"
strSQL = "select * from mytable"
RS.Open strSQL, cn, adOpenStatic, adLockReadOnly
Not Moving To Next Record
hi
all my staff will view for datas in this form. i am using scene table and panel table.
once they select scen1cbo(sceneid), other data will populate but now only one data is populated when i click 1 sceneid. It has more records linked to that sceneid.
(sceneid)SE01 A (panel field)
B
C
D
when i select SE01 it displays 'A' alone i can't able to move to the next records B, C, D.
how to do that?
Code:Private Sub scenecombo_Click()
myquery = scenecombo.Text
Call rLOAD
Do While storyboard!scenes <> myquery
storyboard.MoveNext
If storyboard!scenes = myquery Then
panel_txt.Text = storyboard!Panel
sequcombo.Text = storyboard!sequence
action_txt.Text = storyboard!Action
dialogue_txt.Text = storyboard!dialogue
Image1.Picture = LoadPicture(App.Path & "images" & storyboard("filename"))
End If
Loop
accdb = "SELECT * FROM scene WHERE sceneid = '" & myquery & "' "
'Load SQL query into a variable
Set storyboard = CON.Execute(accdb, adOpenStatic)
End Sub
Moving To The Next Record Using VBA
Hi All - This is really bugging me. I'm trying to move to the next record located in a database. I can not use ADO I must use DAO. I've done this a million times in VB6 but something must be different in VBA(PS I'm doing eveyrthing in Access) because I can not get it to move to the next record. Any help would be greatly appreciated.
Moving To A Record
In an adodc recordset i want to move to a certain record and then return to the original record.
The code should look something like that:
sub cmd MoveTwice()
dim intOriginalRec as integer
intOriginalRec = adodc1.recordset.bookmark
adodc1.recordset.movelast
rem now i want to go back to the originalecord
addc1.recordset.GOTO(INTORIGINALREC)
End Sub
GOTO(INTORIGINALREC) is a method i invented of course. I'll be very gratefull to anyone who could teach me what method or what should i write instead! Thanks in advence !
Could Someone Help Me In Moving My Record Pointer?
hi there!
i m using data control in my form. when i reach eof moving record pointer to next record, realising eof i try to move it to last record or previous record. but the error message is same all the time... "This operation is cancelled by an associated object"!
I have tried each and every possibility.. including recreating database.. but problem persist..
i m tired of this problem and i give it up to you! would you help me out please?????
Moving To The Last Record - Vsflexgrid Used
im displaying records to the vsflexgrid, im using a view to call the records. i have a button "New" which adds a new row to the grid when pressed. what i want to do is, when i press "new" the cursor will automatically go to the empty row so that i wont have to use the scrollbars just to go down to the empty row.
i display the records in my form_load event
Code:
Set rs = New ADODB.Recordset
Set clsADO = New clsADO
Set rs = clsADO.objBrowse(browser)
Set vsf_library.DataSource = rs
and in my New button:
Code:
vsf_library.Rows = vsf_library.Rows + 1 ' adds an emty row
what shall i add in my "new" button then so that the focus will be in the empty row already?
Moving To Next Record On An Error
Hello everyone. I am writing a program that has 5 nested SQL statements. If the first statement does not return anything, then I get and error right down the line. Is there a may to say on error move to next, loop and continue? Everything I have tried is generating an error or doesn't work. Thanks.
Steve
Movelast Not Moving To Last Record : (
hey all,
I have a confusing problem here and i would greatly appreciate any help, thanks guys :)
ado data controler : adodc1 with text boxes etc bound to this, i can add and update records no problem, but when i go adodc1.movelast it moves to the record precding the one i just added, i close the program and try it again, same story, i can search for records and find them, but i cannot browse to them using movenext or movelast, any ideas??
thanks in advance
Moving To Next Record In A Subform Using VBA In A Form?
If I have a regular Access 97 form with no recordset whatsover which merely displays a subform- (the subform of course has a series of records but not the form)? How can I make that subform do a DoCmd.GoToRecord , , acNext using VBA from within the form only?
Moving The Recordset To A Specific Record?
Hey all,
I have a table with a primary key, and the last column of the table stores numbers.
what i want to know how to do is, if i wanted to edit the last column of any particular record, how would I tell the recordset to move to that record by using the primary key as the criteria?
ie. If i wanted to edit the last column (called "seats"), for the record with primary key number 145, how would i do it?
Code:
Dim rs As Recordset
Dim Db As Database
Set Db = OpenDatabase(App.Path & "db1.mdb")
Set rs = Db.OpenRecordset("Flights")
rs. ?????
rs.edit
rs!seats = blablablabla
rs.update
rs.close
db.close
the question marks are where i dont kno wat to do
Moving To Next,previous,first,last Record Problem
Thank you
its me again, sad to say but im encountering a new problem in viewing my file
in this problem im encountering problem
when i press the next and previous button it does'nt show the message box warning and on when i click
the next button it only move once and when i click previous it displays an error that
operation is not allowed in this context and when i click the last button
it will say that rowset doest not support fetching backward
i look at ADOTUT file and the code i use is almost the same except i use textbox instead of listbox
i also try the DO UNTIL syntax but still i encounter errors
What could be the problem?
Please Help Me
Code:
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Command1_Click()
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0;"
conn.Open (App.Path & "cmsdb.mdb")
Set rs = conn.Execute("SELECT lastname FROM cmstable")
If rs.EOF = True Then MsgBox "no more records"
rs.MoveNext
lname.Text = rs("lastname")
conn.Close
End Sub
Private Sub Command2_Click()
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0;"
conn.Open (App.Path & "cmsdb.mdb")
Set rs = conn.Execute("SELECT lastname FROM cmstable")
If rs.BOF = True Then MsgBox "no more records"
rs.MovePrevious
lname.Text = rs("lastname")
conn.Close
End Sub
Private Sub Command3_Click()
Form3.Show
Unload Me
End Sub
Private Sub Command4_Click()
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0;"
conn.Open (App.Path & "cmsdb.mdb")
Set rs = conn.Execute("SELECT lastname FROM cmstable")
rs.MoveFirst
lname.Text = rs("lastname")
conn.Close
End Sub
Private Sub Command5_Click()
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0;"
conn.Open (App.Path & "cmsdb.mdb")
Set rs = conn.Execute("SELECT lastname FROM cmstable")
rs.MoveLast
lname.Text = rs("lastname")
conn.Close
End Sub
.MoveNext Isnt Moving To Next Record...
Hey guys/girls:
I am attempting to use .MoveNext for the first time. I am loading the first record to the app on form load, and when you click on the Next button, it should go to the next record and display it. However, it's not displaying anything. It's staying at the first record all the time. Any chance someone can take a look at the attachment and let me know where I am going wrong pls?
Thanks in advance for your help.
Problems With Moving To Next Record In Loop
The code is working fine for the first run through, adding the updating the appropriate fileds but it doesn't work for the other six records or so. Any ideas why?
Code:
Do Until rstBaseTable.EOF
MidTextTel = Mid$(iTelNum, 1, 3)
dtaPaymentTable.Refresh
Set rstPaymentTable = dbsPhone.OpenRecordset("SELECT CallPrice FROM PAYMENT WHERE CallPrefix = '" & MidTextTel & "'")
PriceAsInteger = CSng(txtCallPrice.Text)
Debug.Print PriceAsInteger; "PRICEASINTEGER"
Set rstBaseTableCalc = dbsPhone.OpenRecordset("SELECT Duration " _
& "FROM BASE " _
& "WHERE TelNum Like ' & MidTelText &*';")
dtaBaseTable.Refresh
DurationAsString = CStr(txtDurationBase.Text)
CallCost = PriceAsInteger * DurationAsString
AddCallCost rstBaseTableAdding, CallCost
If rstBaseTable.RecordCount > 0 Then
rstBaseTable.MoveNext
End If
Moving From One Record To Another In Continous Form
I have a small problem, got a continuos form created by using wizard in Access. One of these field is a checkbox, and are in each row. What I would like to do is to move from Firstrecord to Lastrecord and count for each record if these checkbox field is ticked(true). At the end I would like it prompted to me the number of true checkbox in MsgBox.
Main thing is I don't know how I can get a result for more than one record. Someone please show me a snippet of code to solve this problem, please
Moving Control To Previous Record Field
I hope this is the right forum for this...
I have an Access 2000 sub-form with a bit of VB programming behind it. The fields are layed out like this -
Field1 Field2 Field3
Fields 2 and 3 have some error checking that works fine. Problem I have is that when Field3 finishes it's error checking it creates a new record and goes to Field1 of the new record, leaving a null value in Field3 of the previous record.
Can I somehow do the error checking in Field3 and then have the focus stay there?
Thanks all!
John
Start And Stop A Sound Record Event By A String Receive By The Com Port
Hai guy. Here is my situation. i got a record function, Normally u use the start a record function by a click of button let say " RECORD" button on ur form, but what i need now is the start of the recording to be triger by a text file that i receive from the external device via serial port. Let say:
txttext1.text = MScomm1.input
If txttext1.text = 'START RECORD" Then
call (Record Function)
can i do this?????.
where should i put this code ?????. In the Mscomm_commeven()????.
Can any one provide me some help here. If u don't understand my question here, please feel free to ask. hope i make this clear enough. Thanks And have A Nice day.
Here is my record function i got from VB forum
Private Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" _
(ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, _
ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
Private Declare Function mciGetErrorString Lib "winmm.dll" _
Alias "mciGetErrorStringA" _
(ByVal dwError As Long, _
ByVal lpstrBuffer As String, _
ByVal uLength As Long) As Long
Dim RecdTime As Boolean
Private Function RecordSound(FileName As String) As Boolean
'sound aliased by recsound
cmdRecord.Enabled = False
Dim Result&
Dim errormsg%
Dim ReturnString As String * 1024
Dim ErrorString As String * 1024
Result& = mciSendString("open new Type waveaudio Alias recsound", ReturnString, Len(ReturnString), 0)
If Not Result& = 0 Then
errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
MsgBox ErrorString, 0, "Error"
End If
Result& = mciSendString("set recsound time format ms bitspersample 16 channels 2 bytespersec 22500 samplespersec 44100", ReturnString, 1024, 0)
If Not Result& = 0 Then
errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
MsgBox ErrorString, 0, "Error"
End If
Result& = mciSendString("record recsound", ReturnString, Len(ReturnString), 0)
If Not Result& = 0 Then
errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
MsgBox ErrorString, 0, "Error"
End If
RecdTime = True
Do Until Not RecdTime
DoEvents
Loop
Result& = mciSendString("save recsound " & FileName, ReturnString, Len(ReturnString), 0)
If Not Result& = 0 Then
errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
MsgBox ErrorString, 0, "Error"
End If
Result& = mciSendString("close recsound", ReturnString, 1024, 0)
If Not Result& = 0 Then
errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
MsgBox ErrorString, 0, "Error"
End If
Unload Me
End Function
Hope this is not too long for u guys.
Moving To A Different Record In A Recordset Based On Clicking On A DBLIST
Okay, I have an issue with VB 6.0/DAO 3.51 that I can't get around. I have 2 DBLists that display lists from 2 different fields of the same table that are driven by one SQL query at runtime. I can get the lists to display, but I am having trouble navigating the lists. The operator needs to be able to click on either list and have the other list update to have focus on its specific field of the same record. I initially tried just to select the next item on the list and get the other list to update using the recordset.movenext & recordset.moveprevious methods. I get an error when doing this that says the "Object doesn't support this property or method"
The wierd thing is that the dblists still kind of do what I want after acknowledging the error. I select the item in the list, I get the error, I acknowledge error, then both updates move to the next item in the list. The application doens't crash. I am a bit confused. Here is my code. Thanks, in advance for any assistance.
______________________________________________________
Private Sub DBList2_Click()
Data1.Recordset.MoveNext
End Sub
Private Sub Form_Load()
DBList1.DataField = "ntaID"
DBList1.ListField = "ntaID"
DBList2.DataField = "taskdescription"
DBList2.ListField = "taskdescription"
Data1.RecordSource = "SELECT * FROM nmetls ORDER BY ntaID;"
Data1.Refresh
End Sub
________________________________________________________
Moving To Next Record, And Updating Data Bound Controls
Hey guys,
have a problem. i am forced to use DataEnvionment so dont suggest otherwise. i know it sux.
anyway i have a few controls which is kind of 'data bound' to a recordset in a data environment.
now i want to do a simple record navigation.
like .movenext, etc.
but when i movenext from the Recordset, the DataBound controls doesnt update with the new data. infact, nothing visibly happens.
any suggestions ?
this is the code im using
Private Sub cmdNext_Click()
If DataEnv.rsLect.State <> adStateClosed Then DataEnv.rsLect.Close
DataEnv.rsLect.Open
DataEnv.rsLect.MoveNext
DataEnv.rsLect.Close
End sub
thanks
Deane.
Stop Code From Moving On If "IF" Statements False [Solved]
hi, i want to verifi the first two boxes before it moves onto the rest of the code so if any of the first two if statements are false it doesnt move onto the rest of the code, any 1 have any ideas?
thx much appreachiated
Private Sub cmdcal_Click()
If cboCars = "" Then MsgBox "Error Msg Here"
If txtdays = "" Then MsgBox "Error Msg Here"
lbltotal = lblPrice * txtdays
lbldeposit = (lbltotal / 100) * 20
lblPay = lbltotal - lbldeposit
End Sub
HELP!!! - Past Link From VB To A Other Soft With Past Link.
I was wondering if there was another way to do this instead of going into VBA.
Is there a controle or something link that, that would give me access to the past link.
http://www.scmf.ca/english/vb/PastLink.jpg
So i could do a copy from my total TxtBox to the other soft link word and excel.
http://www.scmf.ca/english/vb/TestApp.jpg
I dont want to do a vba with only 1 soft but have it available to all soft that have a past link in it.
Here is the code!
Private Sub cmdCalculate_Click()
txtTotal = txtNumber1 * txtNumber2
End Sub
Private Sub cmdQuit_Click()
End
End Sub
http://www.scmf.ca/english/vb/VBTest.zip
Frech
Code For Moving To The First Blank Cell In A Worksheet; Moving Left,right,up Or Down
I have created an application form as a userform in Excel. I need to send the data entered into my text boxes when the program runs to separate excel cells in a worksheet.
My problem is I can use code that will send the textbox entry to a specific cell eg. If my textbox is named Surname I can say
range("a5").value = surname but if I do that when I run the programme to enter the next record for someone else the first record will be overwritten.
I NEED A CODE LINE THAT WILL TAKE ME TO THE FIRST EMPTY CELL AND ALLOW ME TO MOVE DOWN OR TO THE LEFT OR TO THE RIGHT
Moving A Record From "inventory" Table To "trash"
Hi All,
I am trying to create a "Trash" button instead of a "Delete" Button which first copies the record to another table and then deletes the record.
I am trying with the code below but its not working and gives Run-Time Error '91' -"Object variable or With Block variable not set" the very first time in "Adodc2.Recordset.AddNew" line :
Adodc1 is connected to the "Inventory" table and Adodc2 is connected to the "Trash" table. Both tables have the very same fields in the same order. Remamber the records are being deleted from the Inventory table (which will never have 0 records). I have also programmed the delete from the "trash" which works fine. My BIGGEST problem is copying a particular record from the Inventory table to the Trash Table.
Private Sub cmdtrash_Click(Index As Integer)
Adodc2.Recordset.AddNew
Adodc2.Recordset("ID") = Adodc1.Recordset("ID")
Adodc2.Recordset("Site") = Adodc1.Recordset("Site")
Adodc2.Recordset("Address") = Adodc1.Recordset("Address")
Adodc2.Recordset.Update
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
PLEASE HELP...... I AM DEAD STUCK
Rs.Update Record Updates Next Record Not Current Record Access DB
For some reason I can't find (lack of VB knowledge obviously) the record that I want to update is updated in the following record and not in the current record.... I'm using Access 2002 database and VB 6. Here is the code: (the DB is opened with "methodaccessdatabase" in a module)
Code:
Option Explicit
Private Sub Form_Load()
Skin1.ApplySkin Management.hwnd
methodaccessdatabase
Set rs = db.OpenRecordset("Responsibility")
End Sub
Private Sub Command1_Click() 'Next record button
If Not rs.EOF Then
Text1 = rs(0): Text2 = rs(1): Text3 = rs(2)
rs.MoveNext
Else
rs.MoveFirst
End If
End Sub
Private Sub Command2_Click() 'update record in database
rs.Edit
rs(2) = Text3.Text
rs.Update
rs.MoveNext
End Sub
The database has only three fields, the one I want to update is field (2 = responsible) jpeg of DB attached...it seems soo simple but I'm stuck!
Thanks
vbprog1144
Edited by - vbprog1144 on 2/10/2004 6:03:37 PM
Past EOF??
I keep getting a past EOF error and don't know why...
Help please =)
Dim strInputFile As String
strInputFile = dlgSelectInput.FileName
Open strInputFile For Input As #1
Do While Not EOF(1)
Input #1, strTransactionID, strRecordID, strHealthNum, strVersCode, strPatBirthDate, strAcntNum, strPymntProg, strPayee, strRef_Prov_Num, strFacilityNum, strIPAdminDate, strRef_Lab_LiNum, strMan_Rev_Ind, strFiller
Loop
Close #1
The file is not open already and everything should work......
The Attached file is the one I'm trying to read
Past EOF But Why?
I've done this a billion times before but for some reason I'm getting a runtime error saying I can't read past the EOF.
Well obviously....
What's wrong here
Dim strInputFile As String
strInputFile = dlgSelectInput.FileName
Open strInputFile For Input As #1
Do While Not EOF(1)
Input #1, strTransactionID, strRecordID, strHealthNum, strVersCode _
, strPatBirthDate, strAcntNum, strPymntProg, strPayee, strRef_Prov_Num _
, strFacilityNum, strIPAdminDate, strRef_Lab_LiNum, strMan_Rev_Ind, strFiller
Loop
Close #1
It's late on a Monday, I'm burnt, and am frankly irritated beyond beleif. Many thanks to whoever points out this most-likely obvious error =)
!!!!!!!!
- PEace
Past
I read somewhere about preforming a search on the net with a VB broswer, can someone refresh my memory and give the link to that topic?
How To Cut And Past
How to cut and paste like MS paint does in window.
Select region and cut something inside and
move it somewhere else. How ?
Excel Past Using VB
Here's my code... I have something copied to the clipboard and this code opens Excel and pastes in. But it only works this way on Windows 2000 Prof... For some reason, on Windows XP Prof, the code opens Excel but doesn't paste anything. Excel has to be open before I run this program on Windows XP, any suggestions???
Code:
Dim XLApp As Excel.Application
Dim XLDoc As Excel.Workbook
On Error Resume Next
Set XLApp = GetObject(, "Excel.Application")
If Err Then
Err.Clear
Set XLApp = CreateObject("Excel.Application")
End If
'Make the application window visible.
XLApp.Visible = True
'Turn off error handling.
On Error GoTo 0
XLApp.Workbooks.Add
XLApp.ActiveSheet.Paste
XLApp.Cells.Select
XLApp.Cells.EntireColumn.AutoFit
Don't Allow Past The End Of The Rows...
I have a form that has a textbox that displays the text from an excel worksheet cell. The reason, I would like the user to be able to edit text on the excel cell via clicking on a commandbutton. In other words the cell mirrors on the textbox (textbox1.value=activecell). The editor checks each cell using another commandbutton with a left arrow on it (offsets to the left)
What I need is a code so the editor cannot click past the left end of the worksheet. Everytime I click using the offset button past the A column it errors on me and debugs.
Excel 2003 VBA
Input Past Eof
Hello guys...me again.
Im not too experienced with sequential file access but this is probably a no-brainer to you guys. Thanks for any help.
I have a sequential text file located at c"divelog.txt that I am trying to read data from. I used the following code on event form load:
'OPEN THE DIVELOG TEXT FILE CREATED ON THE ROOT DRIVE FOR DATA INPUT AS FILE NUMBER ONE ON EVENT FORM LOAD
Open "C:divelog.txt" For Input As #1
Dim txtDdate As String, txtSite As String, txtLocation As String, txtAirTemp As String, txtVisibility As String, txtSpg As String, txtDepth As String, txtBottomTime As String, txtEpg As String, txtWaterTemp As String, txtNotes As String
'READ THRU DIVELOG TEXT FILE ON EVENT FORM LOAD
Do Until EOF(1)
Input #1, txtDdate
Input #1, txtSite
Input #1, txtLocation
Input #1, txtAirTemp
Input #1, txtVisibility
Input #1, txtSpg
Input #1, txtDepth
Input #1, txtBottomTime
Input #1, txtEpg
Input #1, txtWaterTemp
Input #1, txtNotes
'PRINT DATA TO FORM LOG ON EVENT FORM LOAD
Print "DATE:" & txtDdate
Print "SITE:" & txtSite
Print "LOC:" & txtLocation
Print "AIR:" & txtAirTemp
Print "VIS:" & txtVisibility
Print "SPG:" & txtSpg
Print "DEPTH:" & txtDepth
Print "BT:" & txtBottomTime
Print "EPG" & txtEpg
Print "WATER:" & txtWaterTemp
Print "NOTES:" & txtNotes
'LOOP THRU DIVELOG TEXTFILE
Loop
'CLOSE FILE NUMBER ONE
Close #1
When I run the program and load the form I get an error "Run time error: 62: Input past EOF"
When I click DEBUG it highlights "Input #1, txtSite" in the code above.
|