No Current Record
Hi,
I have the following code:
Code: Private Sub Submit_Forms()
Dim i As Long Dim MtstN, FtstN Dim MyDB, RS, lngRSCount, lngStartValue Dim MHP, FHP, MCP, FCP
'This code will set the timer defined in Sub sSleep Const cTIME = 3000 'in MilliSeconds Const clessTIME = 500
'This is the beginning Set MyDB = DBEngine.Workspaces(0).Databases(0) Set RS = MyDB.OpenRecordset("2007 Football Registration", dbOpenTable, dbReadOnly) lngRSCount = RS.RecordCount RS.MoveLast RS.MoveFirst 'Decide where you want to start lngStartValue = InputBox("On which record would you like to begin?", "Starting Participant", 1) With RS If .BOF = True And .EOF = True Then MsgBox "This recordset is empty" Else .MoveLast End If End With try = MsgBox("Number of Records = " & RS.RecordCount, vbOKOnly, "MSG")
RS.Move (lngStartValue - 1) 'cTIME = 5000 'Call sSleep(cTIME)
ForC = RS.Fields("Football/Cheer") FstN = RS.Fields("First Name").Value LstN = RS.Fields("Last Name").Value DOB = RS.Fields("Date of Birth").Value If Mid(Mid(DOB, 1, 2), 2, 1) = "/" Then DOB = "0" & DOB If Mid(DOB, 5, 1) = "/" Then DOB = Left(DOB, 3) & "0" & Right(DOB, 6) MD = Left(DOB, 2) DD = Mid(DOB, 4, 2) YD = Right(DOB, 4) WT = RS.Fields("Weight") GPA = RS.Fields("GPA").Value GPA = Left(GPA, 2)
'too much more to show, but problem is above. Now, I get the 3021 Error every time, unless lngStartValue = 1. Highlighted at the line that begins ForC =... the first variable. My problem is that the BOF/EOF check shows records, and the msgBox shows records (199). Get to the first variable, "No Current Record". I feel like I have tried everything, to no avail.
Any help would be appreciated.
Thank You,
TB
Edit by Moderator: Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.
Thank you.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
How To Record The Current Record Number In A Recordset??
glbRecSet.MoveFirst
Do While Not glbRecSet.EOF
MsgBox "Account Number = " & glbRecSet("AccountNumber"), vbOKOnly, "Search Results"
glbRecSet.MoveNext
Loop
This works fine, but what I want to do is have the it also tell me that this is, for example, record 1 of a total of 5 records in the recordset. I know how to use ".RecordCount" to return the total number of records, but how do I return the number of the current record in the recordset?
Thank you
Kevin
Current Record
Hello
i have this form on access 97 that i use to edit data in one table......in this form i have combo boxes, txtboxes etc.. that i use to show and edit the information of the table ....... my question is the following...i want to edit data that i'm not display in my form such as the creation date of the record...this information is stored in the same table...but i don't need to show it ...so how can i call to the current recordset to save this information in a specific field
Table name tblaltas
field name creadate
i hope someone can help
Thanks in advance
No Current Record
Hi,
I have what I think should be a rather simple problem, but I can't find it. I have added a debug code and I'm not getting anything so I'm assuming that the loop code isn't working because it can't find any records to search. The correct form is coming up, but all fields are blank and when I click either next or previous buttons it says "No Current Record." I kept getting this error before, but after I added the code to check for BOF and EOF it allows me to execute this script, but not for it to work. I was orginally using the Find commands, but I was getting the same error so I tried using the loop. If I run formEditClass itself it works fine displaying all data and allowing me to freely move between records.
VB Code:
formEditClass.Show If formEditClass.dbClassInfo.Recordset.BOF = True ThenformEditClass.dbClassInfo.Recordset.MoveNextElseIf formEditClass.dbClassInfo.Recordset.EOF = True ThenformEditClass.dbClassInfo.Recordset.MovePreviousEnd If Do Until formEditClass.dbClassInfo.Recordset.Fields("ClassName").Value = CSformEditClass.dbClassInfo.Recordset.MoveNextLoop
No Current Record
Hi all
When I open the form that has information in the database , there is no problems at all, but when I open the form with empty database this is the message I get. no current record.
Any one can help me to handl this problem please.
I will be highly appreciated.
Thank you
Mohammed
Getting The Current Record # Using ADO
I'm using Ado to access my database on an MS SQL 7.0 server. I want to know
as I am going through the recordset of a table what Record number I'm at.
Joel Foudy
Current Record
hello.
i just wanna ask is it possible to insert new record to a field and
yet that inserted record will be considered as ist record.
ex. if field 1 has 5 records. and field2 has 0 record.
then i will try to addnew or insert a record to field2.
normally , the inserted record will be considered as record6 of field2.
leaving field2 record 1- 5 as blank.
can somebody please tell me how to do this?
thanks,
anna
Current Record In ADO
Is there a way to find out which record I'm currently looking at in an ADO recordset?
For example, after a series of .MOVENEXT commands in a recordset, I want to know which record out of .RECORDCOUNT I'm looking at.
Thanks,
Yazster
Current Record Row
Hello!
Is there a function (such as recno() in other languages)to get the current record row of a table? I need to save to a variable this current record row so that I can use it later. Thanks in advance!
Get The Record Of Current Date!!!
Table Name = Calendar
CalendarDate Year Workweek Workday
............... ....... ...... ......
30/12/2004 2004 12 4
31/12/2004 2004 12 5
01/01/2005 2005 12 6
02/01/2005 2005 1 0
03/01/2005 2005 1 1
04/01/2005 2005 1 2
05/01/2005 2005 1 3
06/01/2005 2005 1 4
07/01/2005 2005 1 5
08/01/2005 2005 1 6
09/01/2005 2005 2 0
10/01/2005 2005 2 1
11/01/2005 2005 2 2
12/01/2005 2005 2 3
13/01/2005 2005 2 4
14/01/2005 2005 2 5
and so on......
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''
Public Function myFunction ()
Dim rsCalendar As Recordset
Set rsCalendar = CurrentDb.OpenRecordset ("Calendar" , db_open_dynaset)
With rsCalendar
End With
rsCalendar.Close
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''
I want to get the record of Date() which point to Today date . I want to get the row of record of the Maximum value in "Workweek" which is the last Workweek value. I want to move to the next 20 record. If EOF then take the last record based on the Workweek. If not EOF then get the current record. What should i do?
Thanks in advance
Regards,
bananatree
Current Record Lock
hi hope all is well
(i am using microsoft access 2000)
I have a form and also navigation buttons at the bottom of the form.. i would like to lock a current record after it is updated... so the user can not go and edit what has been inputted in the previous row..
can someone help me out please....
thanks in advance - sonia...
No Current Record Error
I have a Access 97 database, and am making a VB interface to add/delete/edit records. I have this one table (called TblResults) that has no records in it to begin with, but I want to add one through VB.
Before I add any records, the table is empty, but some of the fields have a 0 in them, because that was the default entry for the Default Value property. One such field is called MatchID.
I want VB to check to see if MatchID is 0, and if it is, add a new record which has Match ID 1, and then delete Match ID 0. If VB checks Match ID and it isnt 0, then I want to add a new record which has a Match ID of 1 more than the last record.
I entered in the following code:
Code:
With DatResults.Recordset
If !MatchID = "0" Then
.AddNew
!MatchID = "1"
.Update
.FindFirst "MatchID = 0"
.Delete
Else
.MoveLast
Dim LastID as integer
LastID = !MatchID
.AddNew
!MatchID = LastID + 1
.Update
End If
End With
However, I get a error that says No Current Record, and the If !MatchID = "0" Then line is selected as the error line. I think this is because since the table is empty, it cant check to see what is in the field MatchID.
How can I check to see if the table is empty (or MatchID = 0) without encountering an error?
No Current Record Error
I have a program job quoting program that is giving me some problems. I use ADO to create new records in the database... every new record requires a new entry in 3 tables... here is the code that I use to add records:
Code:
Private Sub addrecord_Click()
Dim count As Integer
'Synchronize database and initiate new quote command
Set addcn = New ADODB.Connection
Set addrs = New ADODB.Recordset
addcn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + Form4.Text2
addrs.ActiveConnection = addcn
addrs.Open "JobOrderData", , adOpenKeyset, adLockOptimistic
addrs.MoveLast
count = Val(addrs.Fields("QuoteNo"))
'MsgBox count
addrs.AddNew
'increment quote number
addrs.Fields("QuoteNo") = count + 1
addrs.Fields("date") = Date
addrs.Update
'MsgBox addrs.Fields("QuoteNo")
addrs.Close
Set addrs = New ADODB.Recordset
addrs.ActiveConnection = addcn
addrs.Open "BillofMatl", , adOpenKeyset, adLockOptimistic
addrs.AddNew
addrs.Fields("QuoteBM") = count + 1
addrs.Update
addrs.Close
Set addrs = New ADODB.Recordset
addrs.ActiveConnection = addcn
addrs.Open "QuoteSheetInfo", , adOpenKeyset, adLockOptimistic
addrs.AddNew
addrs.Fields("QuoteNO") = count + 1
addrs.Update
addrs.Close
addcn.Close
'MsgBox addrs.RecordCount
Form1.Text63 = count + 1
Unload Form4
'Goto the new quote created in form1
Form1.getrecord = True
Form1.Command11.Value = True
Form1.Show
To access this new record I use the following DAO commands:
Code:
Private Sub getrecord_Click()
'Locate quote number (not active command)
Data1.Recordset.Index = "QuoteNo"
'MsgBox Text63
Data1.Recordset.Seek "=", Form1.Text63
If Data1.Recordset.NoMatch Then
MsgBox ("Check to be sure you have selected a valid quote no, or the quote number range")
End
'Data1.Recordset.MoveFirst
End If
End Sub
This getrecord sub will work sometimes and other times I will receive NO CURRENT RECORD. I cannot figure out why it works sometimes and not others.
No Current Record Message
I have a delete procedure which I have included a findfirst method in. Now an error comes up in this procedure stating
"No Current Record"
Have I missed something from the findfirst?? or is the loop incorrect?
The last line in the code is where the error occurs:
Dim matflag, matchdel, srchdel As String
'search for match
matflag = ""
matchdel = cbodeletepart.Text
srchdel = "Ryco_part = '" & matchdel & "'"
With fordpal
.FindFirst srchdel
If .NoMatch = True Then
matflag = ""
Else
matflag = "valid"
End If
End With
If matflag = "" Then
MsgBox "Please select a part from the list"
cbodeletepart.SetFocus
Else
parttodel = cbodeletepart.Text
ques = MsgBox("Are you sure you want to delete " & parttodel, vbYesNo)
If ques = vbYes Then
fordpal.MoveFirst
Do Until founddel = "yes"
If parttodel = fordpal![ryco_part] Then
Use Current Record In A New Form
Is there a way to select a record with one form then open another form with the selected record from the previous form set as the current record in the second form.
The problem is when opening a second form the current record is always set to the first record in the table.
Delete Current Record
Hello I would like to know how I can delete the current record in a recordset. I am using Access as database.
Dim RSone As Recordset
Set RSone = New ADODB.Recordset
With RSone
.CursorLocation = adUseServer
.CursorType = adOpenStatic
.LockType = adLockOptimistic
End With
strSQL = "SELECT * FROM HoraireBak ORDER BY DateVente"
Call CopyTable
Set RSone = Cn.Execute(strSQL)
'Some operations on the record
RSone.Delete <----------- Causes Error
I get the error '3251': Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
Anybody has an idea to help me out please.
Thank you.
Sincerely,
Mark
Recordset Current Record?
I am using Access 2000. I am dealing with a recordset and want to know what the current record is, so that the navigation buttons can function properly. Either that or I need to know one record before BOF or EOF occurs.
I know there is a way to use the recordsetclone property of a form to do this, and possibly a way to clone the entire record set and accomplish the same thing, but I am using an unbound form, so the first option won't work, and I will be dealing with large numbers of records (up to 1 million), so I don't want to just make a clone of the whole recordset because I am worried about memory.
Basically, to sum it up, is there any way to know which record I'm at using just the 1 recordset that I am working with, sort of like a CurrentRecord property? I know this may seem like a newbie question but I haven't touched vb in about 6 months, so I apologize in advance.
ADO Update Current Record
Hello,
I am changing an old app from dao to ado. MS Access and using
Code:
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0 "
conn.Open (App.Path & "work.mdb")
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "PartsInventory", conn, adOpenDynamic, adLockOptimistic, adCmdTable
I have a previous, next, new and update button. the update may have a logic issue cause I use it to save a new record and update a current record depending what the command buttons caption. see update button code
Code:
Private Sub Update_Click()
If Text2 = "" Then
MsgBox "The Inventory Item Name field is blank. If you don't want to create a new record click Cancel.", vbInformation, "Empty Field"
Text2.SetFocus
Exit Sub
End If
If Text1 = "" Then
MsgBox "The Quantity field is blank. If you don't want to create a new record click Cancel.", vbInformation, "Empty Field"
Text1.SetFocus
Exit Sub
End If
rs.Requery
If Command1.Caption = "Cancel" Then
With rs
.AddNew 'adding new record
.Fields("PartName") = Text2.Text
.Fields("Quantity") = Text1.Text
.Update 'this updates the recordset etc.
End With
Command1.Caption = "Add New"
Command2.Enabled = True ' disable delete button
ElseIf Command1.Caption = "Add New" Then
Command2.Enabled = True ' enable delete button
conn.Execute "UPDATE PartsInventory SET PartName ='" & Text2 & "' , Quantity='" & Text1 & "'" 'since quantity is a numberic field then there isnt the extra "' around it
End If
Text3.SetFocus
End Sub
the new record button turns to cancel when clicked for making new records. That button if not making new stays as "add New" so this means you are just updating a current record. I need my execute statement to update the current record. the table only has two fields part name and quantity. Current statement makes all records the same as whatever was in the current record.
Locate The Current Record
Hi, I have coding like this, and it updates the all rows in the table , but i wanted to restrict it to only the current record, please help on how to locate the current record and do the update . Thanks.
Set db = CurrentDb()
Set rst = db.OpenRecordset("Table1", dbOpenDynaset)
Do While Not rst.EOF
stScode = rst![SCode]
stLcode = rst![LCode]
If Not IsNumeric(stLcode) Then
stsql2 = "update lTable1 set errormsg='Numeric Value error in Lcode' "
DoCmd.RunSQL (stsql2)
Exit Sub
End If
rst.MoveNext
Loop
Problem With Current Record
Hi all..may i know how to avoid this error during add new data into Database.
"Either BOF or EOF is True,or the current record has been deleted.
Requested operation requires a current record."
I'm so wonder..sometimes it will give me this error and sometimes not..
Thanks
Update Record And Add Value To Current Value
hi,
i want to update a record like:
"update produtos set stock='10' Where ID=( " 1 )
but i want add the current value to the new value for example
the current record have 2 now i want add 10 them the record will have 12
i try this
"update produtos set stock+'10' Where ID=( " 1 )
but this dont work, i already see this right function in other place but i dont remember where i know that is possible any one know the right sintax?
thanks for the help
bruno
How To Set Current Record In A Datagrid.
Greeting All,
I am stuck and need your help.
I have a datagrid that retrieve data from a db thru an ADO recordset.
The problem is that after I change a value in a cell and click the Save button then the change get save in the db. Right after I click the Save button, if I change my mind and go back to that cell right away to change to a different value then click Save, the change does not get saved.
But if I click other row then come back to the row I changed before, then I can change the value and save sucessfully.
Please let me know if I miss something.
Thanks,
ConKi.
Update Current Record
Hi
I have a label which contains an ID now what I want to do is
update the current record if the label contains a value and if not
insert a row....
The code related to the condition is below
VB Code:
If (lblScaleEventID > 0) Or (ObjRSprodidvalues.EOF) Then ObjRSprodidvalues.MovePrevious ObjRSprodidvalues.Update ElseIf (ObjRSprodidvalues.BOF) Then Load frmvoidopid frmvoidopid.Show vbModal Else ObjRSprodidvalues.MoveLast End If lblScaleEventID = ObjRSprodidvalues.Fields(0).Value
I receive an error ' EOF or BOF is true' or record is deleted...
Thanks for your help
Print Current Record
I finally got something workin in crystal report version 9. So my report has been created etc etc. But heres the problem Im having...it displays all the records in the database. I just want to run a print out of the report based on a user entering an ID number...is there a way to do this.
For instance a user is looking at ID # 200..and he wants to print out this record. When I run the report currently it shows all the records in the database...but all I want the printout to do is print ID #200.
Thanks,
Jon
Display Current Record??
I am using the ADO Data Control with access, i have a label where i want it to when the user goes from record 1 to record 2. Basically i wana be able to show the record that the user is on. Is there a way i can do it. I tried with alot of the commands but nothing seems to work
so something like this
You are on record [3] from [5]
Thx for you help.
Showing No Current Record ?
To,
I hope you will clear this doubt.
I want to enter names in the database using textbox.
if it is a first name it should update.if it is a second name which is not
similar to the first that record should be updated otherwise it should be
deleted.
The problem iam getting is not updating new record showing error has"No
current record"
my code:
Private Sub Cmd_updateClick()
Dim WS As Workspace
Dim DB As Database
Dim RS, RSL As Recordset
Dim E As String
Dim I As Integer
Set WS = DBEngine.Workspaces(0)
Set DB = WS.OpenDatabase("C:WINDOWSPATS.MDB")
Set RS = DB.OpenRecordset("EMP", dbOpenDynaset)
E = "select ENAME FROM EMP WHERE ENAME='" & Text1.Text & "'"
Set RSL = DB.OpenRecordset(E, dbOpenDynaset)
RSL.MoveLast
If I = 1 Then
Data1.Recordset.Update
Else
Data1.Recordset.Delete
End If
End Sub
Private Sub Cmd_addnewClick()
Data1.Recordset.AddNew
Text1.Text = " "
Text1.SetFocus
End Sub
Thanks.
brushindia@yahoo.com
Help!!! How Do You Find Current Record Value?
Newbie Here)I have an access database that I am using in VB. I need to return the value of the access database ID# to the program. In other words... I have 30 records, which are actually questions. The program needs to know which question or (Record) is selected. In access, the ID field is set to autonumber and tells which record is being viewed.
How do I do this in VB. I have exhausted my books. They all say how to move to previous, last, next, first, etc., but do not discuss how to show the current record ID.
Is it something like...
dim CurrentRecord as variant
CurrentRecord = data1.recordset.fields("Id")
Trying to figure out which record the database is looking at. Is it record 1 of 30 or record 26 of 30. How do I return this value to my program????
Please offer help.
Thanks,
Sal
View Current Record..
Does anyone know if there is a way to write a record to a table, through a form then hit a command button that writes to the table and have it automatically pop a message box or another form or something that would show me the record number (created automatically) of the entry?
Currently, I fill in the form and hit the "update" command with the following code. It doesn't "do" anything per say, except write to the table.... my problem is that I need to know the number it assigns to the record instantaneously. Any ideas anyone?
Private Sub cmdAdd_Click()
On Error GoTo AddErr
datPrimaryRS.Recordset.AddNew
frmSort.Show
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
Kristin
BACKCOLOR OF CURRENT RECORD
Hi All,
How do I change the back color of the current record in a datagrid as I move from one record to the other.
Any help/code would be appreciated.
Thanks.
Emmanuel.
Print Current Record???
Hi everyone, any help much appreciated.
I have a form in VB6, all items in the form are linked to an ADO, i want to insert a print function to the form which will print the current record displayed, the record itself is saved an an Access DB.
At current i have no code, i have created a report in Access which will display the records, how ever it displays all the records and each record is on a seperate page, im afraid that adding a print function with this will have it print out 298 pages when i only want the one im viewing in my VB program...
Any help with this will be very much appreciated
How To Printout Current Record.
Hi friend,
I have a question about how to print out current record? I used Ms access to create a table which is bugsheet and I use VB to create the interface. after I enter the record. I want to print out only the current record that include the bugID. programmer, describtion..... Also, I hope the printout looks like .doc file.(see attachment)
how can I do it?
thank you
How Can I Update The Current Record ADO
Hello
dear
i am working on the Database but now these day i am facing probelm of Updating the Current record through ADO
i enter the fellowing code but when i exectue i recive an error
i am using UDL and jet 4.0 provider
how can i solve this problem i shall be very thankful to all of you
dim cn as Adodb.connection
Dim rs as ADODB.Recordset
dim cmdup as adodb.commad
dim updateP as adodb.parameter
dim Sqlup as string
set cn = new adobe.connection
cn.connectionstring = "file name = d:myudl.udl"
cn.open
set cmdup = new adodb.command
cmduup.activeconnection = cn
sql = "select * from Emp"
sql = sql &"where empno = ?"
set updateP = cmdup.parameter(,adinteger,input,3)
cmdup.parameter.append updateP
set rs = new adodb.recordset
rs = cmdup.execute
rs!name = txtname.text
rs.update
there are some mistakes in code because at that time i am working on the Computer in which there is no VB
ok sorry for that mistakes
Tamoor Ahmad
OCP DBA
No Current Record Error
Hi,
When I try to do a select statement by opening a record set I keep getting a error that say "No current record". I am not sure why that's happening. Below is the code. Any help will be appreciated. Thanks
Code:
strFullName = Me.txtFullName.Value
strSQL = CurrentDb.OpenRecordset("SELECT FullName from tblClient where FullName = '" & strFullName & "' ").Fields(0)
If strSQL = Me.txtFullName.Value Then
MsgBox "duplicate value"
end if
Edited by - str50 on 5/1/2008 5:17:10 AM
Delete The Current Record
hi all
I am a newbie in VB..I have connected MS access and VB and created a form..suppose if I have 4 records..and I keep moving to the next record using the movenext pointer and have arrived at the 3rd record ..Now if i want to delete it what should be in my delete button code..the problem is if I reach the 3rd record and press delete button the 1st record gets deleted..I have included rs.delete alone in my code..
Display Current Record
In a vehicle maintenance application, I have a list box based on a table, (table1) displayed in a form. The listbox reflects the contents of 2 fields: [EquipmentID] and [PMName].
1. EquipmentID refers to the identification of a vehicle.
2. PMName refers to the name of a preventive maintenance routine at certain intervals ie; PM1, PM2 etc. Each vehicle is assigned its own PM.
3. The table that contains these 2 fields has records for all vehicles and their associated PM's.
I also have table2. Table2 contains static information about each vehicle ie; VehicleID, make, model etc as well as info about when a PM was completed and has a many to one relationship to table1. Thus, table one serves as a lookup table for table2.
The form I am using that has the listbox also has a datasheet type form where I can enter info about each vehicle. As I enter info about each vehicle I would like to be able to visually refer to the listbox to see which vehicles have which PM's assigned to them. However, the listbox displays all of the records for all of the vehicles. How can I filter the records in the listbox to display only those related to the vehicle that I am currently entering information for? Does anyone have any thoughts.
Thank you,
Jim
Status Of Current Record In A Form
I have a form in access which i use to add new records or edit them. It has a save button which I have an insert sql statement being executed (it works fine)into another table.
I want to know what is the status of the record before I execute my insert statement. I need to know if the record is a new record or if it is a record that has been edited/changed in order to execute my insert statement. My code looks like this:
if Me.recordset.editmode = adeditadd then
'execute my insert
else
' continue saving record
end if
this doesn't work!!!
I aslo tried:
if me.recordset.recordstatus = dbrecordnew then
blah
else
blah
end if
this doesn't work either!!!!
HELP!!!!!!!!!!!!!!
francisg
email: mbueno@nycppf.org
Error 3021: No Current Record
I really hate to post another 3021 thread, but i just spent an hour and a half searching the old posts & trying their solutions. Nothing has worked.
Code:
For mintCurrentRecord = 0 To (mintRecordCount - 1)
If Not frmFlashCardMenu.datDictionary.Recordset.EOF Then <--error is here
tmrNewWords_Timer
Else
intResponse = MsgBox("Do you want to play again?", vbYesNo + vbQuestion, "New Game")
If intResponse = vbYes Then
frmFlashCardMenu.datDictionary.Recordset.MoveFirst
Else
frmFlashCards.Hide
frmFlashCardMenu.Show
End If
End If
Next mintCurrentRecord
The program actually breaks in the tmrNewWords_Timer procedure, but after stepping through I determined the problem was the IF .. recordset.eof
A couple of the other posts suggested a Do Loop instead of the If statement, so I tried: (you'll notice two different Do statements -- I tried both)
Code:
'Do While Not frmFlashCardMenu.datDictionary.Recordset.EOF
Do While mintRecordCount > frmFlashCardMenu.datDictionary.Recordset.EOF
tmrNewWords_Timer
If frmFlashCardMenu.datDictionary.Recordset.EOF = True Then Exit Do
Loop
Any ideas?
--just a thought: Do we need a manual/FAQ for common solutions to the Error 3021 problem??
Displaying Current Record# In DAO (easy?)
Hi, (new VB6 user)
I have a data control bound to a .mdb (table). I have read various posts about using the AbsolutePosition property to obtain the current record number. However, when I use it
recordNum = Data1.Recordset.AbsolutePosition
I get
"Run time error 3251"
"Operation is not supported for this type of object"
But
recordCount = Data1.Recordset.RecordCount
works ok.
THe ultimate goal is to display the record # (sequentially) as the user transitions back and forth through various records. I tried binding a text box to the primary key (AUTONUMBER) and this almost works. THe problem is the last record's primary key always increments.
I see that the data control's name is Data1...but is this also the internal database name?...I mean, if I wanted to to access the same database in code versus a bound control, would I have to use the "Open" syntax eventhough the database is probably open through the bound controls?
Any enlightenment is appreciated.
Kevin
Autonumber And Current Record In Datagrid
Trawled threads but can't find specific answer to my prob. Have got a datagrid (properties: not updatable/no additions nor deletions). Data (ADO recordset stored in an Access 97) file uses client cursor/keyset/pessimistic locktype and is bound via dataenvironment. On the form I have controls (dropdowns and textboxes) with an "Add" button which adds (and automatically updates via code [rs.update]) a record to the datagrid. Data integrity/validation are OK. However, my primary key is an autonumber field (to which I obviously do not assign a value when adding a record) that doesn't seem to accept the next autonumber. I get a "0" displayed in the datagrid. I have a "Details" button, that when pressed, runs a query based on the recordset in the datagrid (with the .filter = autonumber of the current record in the datagrid - but taken from the actual rs.fieldvalue not the datagrid cell), displaying the data in a msgbox. This query runs fine as long as I don't attempt to call the current new record. Any ideas? I tried various requeries, refreshes and resyncs, but none have proven successful to date.
How To Extract Current Record Info...
(MS ACCESS 2002)
-I have a Main Entry Form ("MainForm) with a data entry subform (SubForm) that is basically my data entry.
-If I enter data in a combox that is not in the list, I have the NotInList event triggered.
-When I trigger this event, I run through a procedure that asks if you want to add this new item to the list or not.
Now this is where it gets foggy- can this be done?:
I would like to use data from the current record other than the field which caused the NotInList event to trigger to aid in putting the new data in its correct place. I know you can use .CurrentRecord when executing a VB SQL Query but I am just working with form data based on a non-VB based SQL query. Any tips?
Let me know if the info provided is too vague.
Thanks.
Current Record Set Does Not Support Upadating
can anyone help me with this i'v been trying to fix this but i can't. ive already done the solutions posted in forums but still having error...
the error is the .fields(0) = txtappid down... please help me... thank you in advance.
VB Code:
Private Sub Form_Load()tbInquiry.Open "Select * from tbinquiry", cn, adOpenKeyset, adLockOptimisticCallFieldsEnd SubPrivate Sub LV1_Click()str = "Select * from tbinquiry where ApplicantID like '" & LV1.SelectedItem.Text & "'"Set tbInquiry = cn.Execute(str) With tbInquiry If .BOF = False And .EOF = False Then txtFind = .Fields(3) & " " & .Fields(1) & ", " & .Fields(2) End IfEnd WithEnd Sub Private Sub cmdSave_Click()Frame5.Visible = TrueFrame4.Visible = FalsetxtSummary.Text = "(New Entry Saved. CLick Next To Proceed." With tbInquiry .Fields(0) = txtAppID .Fields(1) = txtAppInfo(0) .Fields(2) = txtAppInfo(1) .Fields(3) = txtAppInfo(2) .Fields(4) = txtAppInfo(3) .Fields(5) = txtAppInfo(4) .Fields(6) = cmbTFA.Text '.Fields(7) = 'AddFields .Update MsgBox "Edit successfully saved to the record.", vbInformationEnd WithEnd Sub Private Sub Form_Load()str = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "Set tbInquiry = cn.Execute(str) With tbInquiry If .BOF = False And .EOF = False Then txtAppID = .Fields(0) txtAppInfo(0) = .Fields(1) txtAppInfo(1) = .Fields(2) txtAppInfo(2) = .Fields(3) txtAppInfo(3) = .Fields(4) txtAppInfo(4) = .Fields(5) cmbTFA.Text = .Fields(6) End IfEnd With
Recordset Counting On Current Record
Hi Everyone,
I have my recordset declared as rs. I'm trying to run a progress bar which will show how many records the search has gone through. I don't have VB6 on this machine, so I was wondering if someone could just check my logic/syntax.
So to accomplish this I will do the following:
Open the Recordset
VB Code:
Dim iCsrNum as Integer 'to hold the total number of customersiCsrNum = rs.RecordsetCountProgressBar1.Max = iCsrNumProgressBar1.Value = 1
My question is, is there any built-in way to find the current record number, as opposed to creating a counter for each record? For example is there any easy way like?
VB Code:
Do Until rs.EOFProgressBar1.Value = rs.CurrentRecordNumLoop
As opposed to this?
VB Code:
Dim iCurrentRecCount as IntegeriCurrentRecCount = 0Do Until rs.EOFiCurrentRecCount = iCurrentRecCount + 1ProgressBar1.Value = iCurrentRecCountLoop
Does my question make sense?
Current Record : Crystal Reports
Hello friends
I have Crystal Reports 8.0 installed and i use Crystal Report Viewer (CR Viewer)
control to view reports.
Assume one situation where report is grouped (or indexed) with a field 'InvoiceNo'.
'InvoiceNo' is a primery key in the table on which the report is built. Clicking
NextPage button will display next record, clicking PreviousPage will display previous
record.
Now how do i come to know which record i am viewing. I mean to say, which 'InvoiceNo' i am viewing.
Any help will be greatly appreciated.
- Deepak
Saving Your Current Record To A Icon
Hello all,
I have developed a purchase req program and had a question about saving specific records. Right now when I save a req, I just put the pr number into a rich textbox and save that as a .spr file. On open I have my program check whether there is any text in the rtbx if there is it opens the associated record in my database and populate the form. This is the only thing I use the RTBX for and hoped someone would have an alternative. Any ideas?
Single Click Current Record
Hi !
I am using MSAccess Dao. Problem is when I click (single) the dbgrid the current selected record was not shown in the text box, the previous selected records was shown. But If I use Double click option it works fine. Can any one give the syntax so that it will show only the current record while using single click
Private Sub DBGrid2_Click()
Text1.Text = Data2.Recordset.Fields("ino")
end sub
Finding Current Record In A Recordset
Hello, I'm hoping for a really simiple solution here. I want to get the current record number from my set, in the same fashion as Recordcount yeilds the total records in the set.
Report To Only Show Current Record
Hello
I have a Data report made from the designer. I'm using a Data Environment connection, linked to an Access db. On click of a button on vb form, I'm showing this report, but it displays all records. I went to the 'Advanced' tab on the Command properties and unchecked the box 'All Records' and specified a max of 1 record, nut still the report shows all records. I was wondering if there is a way to show the report for only the current record in the vb form?
Any help would be greatly appreciated.
Jeremy
|