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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Get Record Of Current Date Based On Specific Table
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
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
DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...
I need something that can successfully subtract two dates...
eg. calculate the difference between the current date
02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
...
which will then output a result of 5 days
So what I need to know is...
1.
I need to know how to get the current date from the system clock
2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)
3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).
But I have little idea how to go about this
Can anyone please start me off?
DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...
I need something that can successfully subtract two dates...
eg. calculate the difference between the current date
02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
...
which will then output a result of 5 days
So what I need to know is...
1.
I need to know how to get the current date from the system clock
2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)
3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).
But I have little idea how to go about this
Can anyone please start me off?
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
Date Picker Control Doesn't Show Current Date In Field
How do I set the display date in the Date Picker control field ? MSDN says that it should return the current date by default, but it only shows the current date highlighted in the drop down calendar.
The control shows the date when the control was created and added to the form.
How do I set the date at form load ?
Code:
dtpicker1.value = ? ' how do I call current date ?
Using The DATE To Transmit 2 Days Ahead Of Current Date (RESOLVED Thank You)
It seems simple, ive looked and looked, cannot find it. . .
basically what I need to do is transmit 2 days ahead of current date. . .
IE today is the 14th, I need it to auto transmit it to the 16th.
Its a pend out date on an account, I've got everything auto except for this feature. . . .
If I get in touch with a client, I want the account to automatically pend the account out for 2 days.
Thanks for the help, love the site, look for me more often, and be sure to purchase some of my award winning albums at a christian store near you.
Edited by - Bryan Duncan on 6/15/2004 3:52:58 PM
Simple Prob: Current Date - A Given Date
I am trying to subtract a given date value from the current date and the following is what I am trying to use but its saying 'Type Mismatch'. I know this has got to be an easy one, Any suggestions??
txtDaysSinceAssnd = DateDiff("d", DateValue(Now), DateValue(txtDateEntered))
How To Convert Current Date To Julian Date
Hi,
I would be very thankful if anyone can help me with this date conversion from the Current Date in DD/MM/YYYY format to Julian Date.
Many Thanks in advance,
Praveen.
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 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.
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!
Date Format But Not Current Date HOW?
I am new to VB. Work with VB5 Enterprise.
I think this should be simple, but I cannot figure it out:
How do I create a text-box in which the user can write a random date that is not today's date. And still keep the date format?
Example: User inputs 12122009 and I want textbox to change into: 12-12-2009 or 12:12:09 or 12-12-09 or 12:12:2009.
The change should be instant or at the latest at "lost focus".
All the examples I have found work with the current date.
Any ideas?
All the best
Svanholm
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
|