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

Open Access Form And Goto Last Record??

I'm very new to VBA and am trying to create a small sub for a button...when clicked it opens another form and goes to the last record. This only takes me to the new form -- what can I add to make it go to the last record? thank you.

Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Mail Count"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit Sub

MsgBox Err.Description
Resume Exit_Command2_Click

End Sub

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Make A Form A Goto Record Number

i have a form with text boxes etc that is used to navigate through a table.

I use the following code:
DoCmd.GoToRecord acDataForm, "frmNavigation", acGoTo, lngRecord

to goto a certain record where lngRecord is the record number.

However, what I want this to go to is not the record number but the record id (the primary key)

so say I have the following data in a table:


and I want it to make the navigation form change to record ID 5, lngRecord would equal 3.

BUT I dont know that the record with RecordID=5 is record number 3. so how do I find it out?

so Basically I want something like:
DoCmd.GoToRecord acDataForm, "frmNavigation", acGoTo, "WHERE RecordID=5"

hope that makes sense.

MS ACCESS: Goto Subform From Main Form
I am told the following:
"Putting a subform within a subform is usually not a good idea. This
makes the inner form harder to address with Visual Basic from the main
form." - How else can I get MS Access to afford me efficient data capture? Any ideas?

Access An Access(Open/adding Record/editing/deleting /all
i am muhilan from mumbai,india.
i want to access an access(Open/adding record/editing/deleting /all
process) database file which is in MDE format via ADO in VB6
is it possible ? how? please tell me
with regards

Open A Child Form At The Same Record As Its Parent Form
I am trying to open a child form from a parent form, say the parent form is on record number 20. 20 is the ID number for the record. I want the child form to then also move to record number 20.

These forms are of the same table data, I just want some of the data displayed on the child form top avoid congestion.

I've looked at DoCmd.GotoRecord and DAO options. I think an ADO option is too complicated for just form data.

Thanks in advance for any help you can provide.

How Do I Open A New Record In A Sub Form?
Hi, I have this code I am using in one form to open a "sub" form in MS access 2002.
It calls the ID (LngFamilyID) and if the the sub form has that ID it opens it.
My problem is when the sub form does not have that paticular ID it opens the first record.
How do I make it so IF there is no ID matching THEN go to the end of the record set, make a new record AND put the ID from the originating form in to the ID of the new record I just created.

Clear as mud?
Any way, here is my code I am using to open it right now.

AdoptFam is the name of the Check Box

Private Sub Command116_Click()
If AdoptFam = True Then
DoCmd.OpenForm "FrmAdoptF", acNormal, , , , , Me!LngFamilyID.Value
End If
End Sub

'And the code for the ID of the sub form...

Private Sub Form_Open(Cancel As Integer)

Dim strFamID As String
If Not IsNull(Forms!FrmAdoptF.OpenArgs) Then
strFamID = Forms!FrmAdoptF.OpenArgs
If Len(strFamID) > 0 Then
DoCmd.GoToControl "FamilyID"
DoCmd.FindRecord strFamID, , True, , True, , True
End If
End If
End Sub

Thanks a lot, Jacob

Open Form To A Specific Record
I would like to be able to select a record from a listbox, and then open the corresponding record in a different form, using the PhysicianID field which is the sixth (but not visible) column in the listbox. I keep getting a "missing operator" message, and I'm sure it's right in front of me, but I'm not seeing it. Help is appreciated!

DoCmd.OpenForm "frmPhysicianInfo", , , "[PhysicianID] = " & Me!lstPhys.Column(6)

GoTo Record
Beating my head on the wall with what is probably very simple code...

Using MSAccess...

I have a form (contact info), and subform (call info) for a recruiting contact management d/b.

My main form has an unbound combo box that reads last names from a query. Mainform also has the same info, but it is fed directly from the table.

What I want to do is have my managers select a name from the unbound combo box, and have the form go directly to that record. I'm having a lot of problems making this work for some reason. What code could I use that would:

1) Automatically go to the record that meets the criteria in the unbound combo box (i.e., last name)?
2) That at the same time refreshed the data in the subform as well. One to many relationship between tables main and sub works well, but I can't get it to work on the form.

It's probably right in front of my face, but stupid little me can't get this to work even though I have done it in the past on other d/b's. Just can't remember how, and don't have access to my old d/b's anymore....



Change Record Source In An Open Form
What is the best way to change the recordsource on an open form. I tried refresh, and repaint options (toward the bottom of the listing). I have a default setting for users that show only their records in the database. There is one Admin user, and I have added this button so he can see all users records. I wish to be able to toggle this back and forth. I do think the logic is working, but the form is not displaying the results...

This is VBA 6 for Access XP (2002).

Thanks in advance for the help!

Private Sub cmdAdmin_Click()
' Dim UN AS String (PUBLIC)

' Apply a filter for user login to only display records for 'Assigned To' field for the specific user...
Dim USERNAME As String
' Dim Q As String (PUBLIC)

If Me.cmdAdmin.Caption = "Admin Priv" Then
Me.cmdAdmin.Caption = "Std User"

Select Case UN

' Super User
Case "mpopovich", "sanderson"
USERNAME = "Marko Popovich"

End Select

End If

If Me.cmdAdmin.Caption = "Std User" Then
Me.cmdAdmin.Caption = "Admin Priv"

Select Case UN

' Super User
Case "mpopovich", "sanderson"
USERNAME = "Marko Popovich"
Q = QRYWHERE & " AND [Assigned To] = '" & USERNAME & "' "

End Select

End If

Forms!frmentryform.RecordSource = "SELECT * FROM tblMain " & Q & "ORDER BY [Entry Date] "


End Sub

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.

Open New Form With Record On Click In Datagrid
Can you help me. I want to double click a record in a datagrid and want to open another form and be on the record that I clicked on.

Open Form And Change Record Source?
I need to open a form from a button and change the record source to a different query. Here is the module I have created to open the form.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Shawn_Initial_Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Is is possible to modify this code to open the form but change the record source to a different query?


Open A Bound Form To A Specific Record
Hey guys, been trying to figure this out and am losing my mind. Basically I just want to be able to open a bound form to a specific record by the unique ID of the record that the form is bound to. Right now, when I open the bound form, it starts at the first record, I want to open the form from another form based on a query, or should I bind it to the query itself in order to do this?

DblClick MSHFlexgrid To Open Record In Form
How can I double click a flexgrid on a form that will open up the selected record in a new for to show more information? I found some information while searching vbcity, but I think the post has been deleted (link on the post), so I could not get the answer. The post id was 6702, but apparently it does not exist.

Many thanks!


Goto Specific Record
Does anybody know how to go to a specific record in a table using VB?

Here's what i mean

I have a table with ID, INFO, NOTE



1 | Text1| Text1 row1

2 | Text2| Text2 row2

3 | Text3| Text3 row3


what i wanna do is if i entered 2 in a textbox and press enter,

it'll display the "Text2" in a textbox, and "Text2 row2" in another textbox

Any help would be appreciated.

Thank you


MS Flexgrid Click On Cell Open Form Showing Same Record

Have a form which shows each record in an Access Database that has a lot of detail.

Then made an msflexgrid to show all the records in a grid fashion with less detail so the user can see the important stuff for all records at a glance.

Would like the user to be able to click on a row in the flexgrid and open the corresponding record which has the more detail and can edit etc. in the form.

Any suggestions on how to approach this?

Click on Msflexgrid row (anywhere)

open.Form1 with the same record as as the user clicked on the Msflexgrid.

Please Help!!! Form2 Needs To Open With Selected Record On From1 - Not Datagrid Form
Problem is that I have Form1 (not datagrid) that uses db1 (access database). db1 has ID field. Form1 has a button that opens Form2. Form2 (not datagrid) that uses db2 (access database). db2 has ID field. Form1 and Form2 work fine by themselves. What I need to do is when Form1 button is clicked, Form2 showing only the records where Form1/db1 ID field matches Form2/db2 ID field. Please help!!!


Open A Form In Access And Run A Code From That Open Form, From VB?
I wanna open a form in Access and run a code from that open form, from VB. Is that possible, if so, how?

Goto Record Detail From Datasheet - Problem
Another Vba problem

I have created an Access db with a front-end consisting of a number of forms.

One form 'frmRecordDetail' shows a complete record with its 12 fields. Another form 'frmRecordList' contains a subform 'subfrmList' which displays as a datasheet 4 fields from each record. The user is able to sort ascending/descending on any of the 4 fields. What I would like to happen is when a user double clicks on a particular record the form 'frmRecordList' closes and the form 'frm RecordDetail' opens displaying the record that was selected from the datasheet.

I thought the following code would work but all I get is Invalid Outside Procedure error

The code is placed in the dbclick form event for the subform and goes like this.....

Private Sub Form_DblClick(Cancel As Integer)

stFrmName = "FrmDisplayRecord"
stLinkCriteria = "[RefNo]=" & "'" & Me![RefNo] & "'"

DoCmd.Close acForm, "FrmRecordList"

DoCmd.OpenForm stFrmName, , , stLinkCriteria

End Sub

Hope someone can help.....

Combobox On Access Form To Populate Form With Record
Hello code masters
I have a database using Access 2k and some VBA. I want to use a combobox to go to a record and populate my form with that record. Currently I have another form I can go to from this one that has a listbox that will allow me to do the operation I just described. But I can’t seem to duplicate it from the main page. I guess that is a separate issue for now I would like to get the combobox working. This code works in another program I have.
Some names I’m using

So far I have…
Option Compare Database
Private Sub cboFirst_AfterUpdate()

    ' Find the record that matches the control.
    Me.RecordsetClone.FindFirst "[ID] = " & Me![cboFirst]
    Me.Bookmark = Me.RecordsetClone.Bookmark

End Sub

Private Sub cboFirst_Enter()
   cboFirst.BackColor = 16777215 ' Change background to white.
End Sub

Private Sub cboFirst_Exit(Cancel As Integer)
   cboFirst.BackColor = 12632256 ' Change background to gray.
End Sub

Private Sub ShowRecord_Click()
' find selected record
    With Forms!frmContacts
          .RecordsetClone.FindFirst "ID = " & lstFirst
          .Bookmark = .RecordsetClone.Bookmark
    End With
' close dialog box
    DoCmd.Close acForm, Me.Name
End Sub

this is what I have in the combobox properties – Row source - SELECT DISTINCTROW [tblcontacts].[ID], [LastName] & ", " & [FirstName] AS Expr1 FROM tblcontacts;

I click on the combobox and nothing happens.


How Can I Open Access From A Menu And Refresh The Form When Access Closes
Can any one tell why this doesn't work?

The problem is it works only after reopening access after
having edited and closed access once.

The Shellexecute works, so does the loop and
GetActiveWindow() works also, as do the refresh calls
and functions......

Short of running a timer refresh it is driving me mad!

I have two listboxes on my form which contain Data
I want to be able to Shellexecute to My Mdb to edit Data in
Access and return to my form with the Data in the two listboxes refreshed.

VB Code:
'the API's are dimmed in a module Public Declare Function ShellExecute Lib "shell32.dll" Alias _"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ByVal lpFile As String, ByVal lpParameters As String, _ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long  Private Sub mnuOpenDB_Click()Dim lngdb As Long     Dim lhWnd As Long        lhWnd = GetActiveWindow()    'Should be the same as Me.hWndScreen.MousePointer = vbHourglasslngdb = ShellExecute(Me.hwnd, "open", "OrdOut.mdb", vbNullString, App.path, 1)If lngdb <= 2 Then    MsgBox "Unable to Find The Database.", vbExclamation, "The Database is Missing"End IfDo While lhWnd = GetActiveWindow()        DoEventsLoop EmData.Refresh EData.Refresh'this is a function LoadEmailListBox'this is another function 'both of the functions work well loadFileListScreen.MousePointer = vbDefault End Sub

wit respect


Open Access Form From A Password Protected Access Database Through VB
Iam using a password protected Access database. I can open the database with out any problem. There is a startup Access form associated with this database. I would like to open this form with out any prompt to the user for the password. When the program is run, the database opens twice. The first instance with the login screen prompting the user for the password. The second instance opens as desired. How to overcome this problem with the program opening the form only once.

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
Private Const VK_CAPITAL = &H14
Private Const KEYEVENTF_KEYUP = &H2

Private Sub SafeSendkeys(ByVal keys As String, Optional bWait As Variant)
Dim keysBefore(0 To 255) As Byte
Dim keysAfter(0 To 255) As Byte
Call GetKeyboardState(keysBefore(0))

If IsMissing(bWait) Then
Call SendKeys(keys, False)
Call SendKeys(keys, CBool(bWait))
End If
Call GetKeyboardState(keysAfter(0))

If keysBefore(VK_NUMLOCK) <> keysAfter(VK_NUMLOCK) Then
End If
If keysBefore(VK_CAPITAL) <> keysAfter(VK_CAPITAL) Then
End If

If keysBefore(VK_SCROLL) <> keysAfter(VK_SCROLL) Then
End If

End Sub
'Under a click event I have:
UserApps(AppAP).appRunPath = "C: estdb1.mdb"
If UserApps(AppAP).appAvailable = True Then LaunchFile (UserApps(AppAP).appRunPath)
hApp = FindWindow(vbNullString, "Password Required")
Call SetForegroundWindow(hApp)

Call SafeSendkeys("password", True)
Call SafeSendkeys("{Enter}", True)
What is wrong in my code?

Thanks in advance.

How To Open An Access Form From A Password Protected Access Database?
I have a password protected access database. I can open this database. Though the startup form (Access form) comes up, the database opens twice. One instance with the login screen for the password (since the database is password protected) and the other opens properly with the form. Can any one help in opening without the first instance occuring?

UserApps(AppAP).appRunPath = "c: estdb.mdb"
If UserApps(AppAP).appAvailable = True Then LaunchFile (UserApps(AppAP).appRunPath)
(AppAP).appRunPath, "password")
hApp = FindWindow(vbNullString, "Password Required")
Call SetForegroundWindow(hApp)
Call SafeSendkeys("password", True)
Call SafeSendkeys("{Enter}", True)

Thanks in advance,

Last Record In Access Form
I am building an Access module that uses existing command buttons on a form to perform tasks.
The buttons are being used similar to the navigation buttons found at the bottom of forms.
However, when the last record is selected and when I hit my Next button I get an error message something like "Cannot access specifed record" because there are no more records to go to.

My question is, what is the syntax to know what the last record is if new records are constantly being added? So I cannot hardcode like I did for my Previous button

If lngrecordnum <> 1 Then
DoCmd.GoToRecord , , acPrevious
MsgBox "First Record"
End If

I am assuming I should use some sort of RecordCount syntax, but I am unsure of how to do it.

Any help would be great. Thanks

MS Access, Can't Add Record To Form.

I've made a database, see attached. I'm having problems adding records to the database. Each of the tabbed subforms controlsource is a query filtering data specific to the category chosen by the user. I'm pretty sure i was able to add to it when testing so why not now?



Access - New Record On Child Form
I have an Access database with tables named [Customers] and another named [Customer's Computers]. [Customers] to [Customer's Computers] have a one-to-many relationship. (using a autonumber CustomerID Field)

I've made a Single Form with all fields from both tables in it. So, there is data comming from 1 form into 2 tables. The form does not have a subform nore does it have a linked form.

When the user of the form fills out the form, and clicks my save button, they make 1 recoard in each table.

I have another button on my form, "Add Computer", in which i'd like to be able to keep all of the info/fields from the [Customers] table but clear all the field boxes for the [Customer's Computers] to add a new recoard to that 2nd table.

The idea here is that 1 customer can have multiple computers.
And I need to be able to add a new record to the computers table.

I know if I had a subform/linked form it would be as easy as: DoCmd.GoToRecord , , acNewRec

Finding A Specified Record With A MS-Access Form

I would like to open a form from within another one.

The idea is that my main form contains a sub form presented in Datasheet mode. When I double click on the "selector" of a particular line I want to open the subform in Form mode, bu I want to see the particular record on which I doubleclicked.

I get to the point where I open my sub form with the correct dataSet, but, and I am passing the index of the line on which I have doubleClicked, but I'm just not sure how to scroll my subform to rech the desired page.

Can anyone help me please.

Thank you.

Record Source For Access Form

Can an access form using two table for its record source at the same time????

I know...But don't want to use query..

Thanks in advance.

Need Help To Insert A Record In Access Db From An Asp Form

Can someone help me with this code in inserting a record from an ASP form to Access DB. After I press submit button it goes to next form but nothing is entered into the database.

Thanks for you help.

<!--#include virtual="/Connections/connregisform.asp" -->
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "frm_register") Then

MM_editConnection = MM_connregisform_STRING
MM_editTable = "PresentersInformationTable"
MM_editRedirectUrl = "/PresenterForm.asp"
MM_fieldsStr = "Organization|value|LastName|value|FirstName|value| MiddleName|value|regisEmail|value|regisPassword|va lue|usergroup|value"
MM_columnsStr = "PrOrganizationName|',none,''|PresenterLname|',none ,''|PresenterFName|',none,''|PresenterMName|',none ,''|PrEmail|',none,''|PrUserId|',none,''|Presenter sId|none,none,NULL"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery

If (MM_editRedirectUrl <> "") Then
End If
End If

End If

Edit Access Record In A New Form In Vb.
First off, thanks for any replies given. This ones has boggled me for days.

What i would like to do is simply provide the user with the ability to edit an access database record in a new vb form. However, the catch is that i need it to open the record that is currently being displayed on form 1. Simply put: when the user clicks EDIT, another form (form2) opens with the record that they were currently looking at on form1. Then they may edit it from there.

I am using an access database (.mdb) with ado and a data object

Let me know if anyone has any ideas.

Thanks again for any assistance!

Edited by - vbawetch on 5/27/2004 10:14:07 AM

Show Access Database Record In New Form.
Hello, and thanks for any replies given to this post. It is much appreciated.

My problem is this, although im sure the cure is quite simple:

I am accessing an access database using ado and would like to open a record in a new form. Its an edit command basically,but in a new form. The problem is that it always comes up blank, or to an empty record. I just need to find out how to specify that Form2 should load the record that is currently being view in Form1.

Any ideas or comments are appreciated.

Thanks in advance!

Access- Pull Up Same Record After Form Closes
I have a form that I am using to work a report. I have the form programmed to save the account number into a table of the record that was last viewed upon unload of the form.
Now I need to find a way to pull up that record in the form when it opens again.
For example, if I have 100 records in my form. I stopped at record 35 at the end of the day. I come back the next day and open the form, it is on record 35 of 100. all the work I did yesterday is 1-34.. help please!!

Record Selector Combo Box In Access Form
I am trying to create a Record Selector Combo Box in an Access Form with VBA

I have attached the DB in zipped format for anyone who would care to take a look for me...I'm not sure why it won't work at this point, the only guess is because of the tabbed control on the form. It seems to work in just a parent child relationship of a main form and a child, but as soon as I try to create a tabbed area with subforms placed on it then it stops working:

Here is the code I have used so far:

Code:Option Compare Database
Dim strSearch As String

    strSearch = "[CompanyName] = " & Me![cboSelect]"
    Me.RecordsetClone.FindFirst strSearch
    Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Private Sub Form_Current()
    Me.cboSelect = Me.CompanyName
End Sub

With the purple line as where the error lands...Error 3077 as error in syntax string.

The form is frmCustomerOrders.

Thank you

Edited by - NMP on 4/7/2004 7:59:03 AM

Sending Current Record From One Access Form To Another.
Hi Friends,

Hope you all are doing well. I have created two access forms. I am able to pass the server filter to the second form but I need that I will also open the second form, such that – current ID of the first form will be also shown in the second form.

Any kind of help will be appreciated.

Thanks & Regards,


Detecting Record Update Of Form In Access 2K
Hi ...

Another question of continuous forms in Access ... My timesheet entry has edit fileds for regular, overtime, and doubletime hours. I have a label which displays the accumulated hours in the footer. I want the form to work such that ONLY when the values are updated in the table that is bound to the form will the total hours be updated ... I currently have a trap on the AfterUpdate method of each editbox and it works but for repeated edits will artificially inflate my total hours ... Any tip on the event/method I could use?


- Mike

Open Access Report From Ms Access Form
Hi all,
  I created one report in ms access. How can i open that report results from ms accesss form on command_click?
  please help me.

Thanks in advance

Access 97 (run Code When Opening Form And When Changing Record)
I need to run some vba-code when opening a form, is that possible in access 97?
I also need to run some vba-code when i go to another record.

Are these things possible? And If they are, how do i do that.

So, is there some like this possible?
Private Sub Form_ONOPEN(Cancel As Integer)
MsgBox "open", vbOKOnly, "jaja"

If (Me![Totale Waarborg] = False) Then
Me![Keuzerondje114].Locked = True
Me![Keuzerondje116].Locked = True
Me![Openboek/Geslotenboek] = 0
End If
End Sub

Private Sub Form_ONRECORDCHANGE(Cancel As Integer)
MsgBox "open", vbOKOnly, "jaja"

If (Me![Totale Waarborg] = False) Then
Me![Keuzerondje114].Locked = True
Me![Keuzerondje116].Locked = True
Me![Openboek/Geslotenboek] = 0
End If
End Sub


Help Me. Main/sub Form In MS Access. Error: No Current Record!
I am developing one tool which using MS Access. I designed a form with main/sub form. And I get information from sub form like this code line:
But I received one error: No current record.
I tried to use both Set Focus and Requery method, but it does not run.
If you know, pls kindly show me how to solve it. Thanks first!

VBA/Access: Checking Checkbox On Record Change In Form
Hi all,

I hope this is in the right place, if not, I do apologise:

I have a form, which contains a checkbox, when the checkbox is ticked, a texbox appears, when it is unchecked, the textbox disappears. Problem is: When I load the form up, if the checkbox is ticked, the texbox doesn't appear (since the event procedure is only activated when I click on the object.)

I need the checkbox status to be checked EVERY time a record is changed so that depending on whether a record has a tick in the box it will either show or hide the text box. This can differ between records so I need to check every record.

Is there a quick way of doing this without opening a database connection, then creating a object for the recordset and doing it from there?

Thank in advance for any tips/tactics.


Hide Or Get Rid Of Blank Record In Form View (Access)
In my subform there is always a blank record displayed as the last row in the view. I only want the rows in the recordset shown and not the Add row. I have the form properties set for No adding, No deleting but I do allow editing of the current record. I have an Add and a Delete command button so that I can do some work on the DB before adding or deleting the record. So all I want to show is the recordset without the blank.

How about it, is there a way to kill it?


The worst thing about wearing glasses is them being on your face.
Nothing is impossible, it just looks that way.

Access: Query Results As The Starting Record For A Form
Good morning, everyone!

I am developing a project for work and have hit a roadblock with one of my forms. The database purpose is to track personnel information such as training accomplished, contact information, and other information useful in the workplace. I currently have my main form, frmInformation, set up to display each person's information, which is pulled from tblInformation.

In the upper right-hand corner of frmInformation I have placed a search box that allows the user to search for employees by last name, using a standard query, qryNameSearch, as the means of returning records. What I want to do is move to the first record that the query returns.

Example: My first record contains information for John Anderson. However, I want to pull up information for Joel Throckmorton, so I type "throck" in the search box. When I click Go, the form advances to the information for Mr. Throckmorton.

Advanced question: This one is not quite as important, but would be helpful for users prone to misspelling. Is there a way to step back a letter and repeat the search until the query obtains results?

Example: I want to look up Mr. Throckmorton's information, but I type in "throcl" instead of "throck". Since I have no one in the database whose last name contains those letters, the query will return no records. If the query has no results, I want the sub to run again, this time backing up a letter, so the search is for "throc" instead, which will return results.

Thanks-- I look forward to seeing how easy of a solution this one has!

Access 2003 How To Jump Automatically To New Record In The Form
In access 2003 I have created form that is used to input new records to database.

My database currently have quiet few records and always when I need to input new one using this form I have to use >* (new record) button after opening this form.

I would prefer to directly start with new record input sheet in this form.

Edited by - berduchwal on 2/13/2006 7:25:20 AM

Access - Open Another Form
I'm trying to open a modal,popup form as I click on an image from another form:

Private Sub Immagine3_Click()

Dim frmRiepilogo As New Form_Riepilogo

frmRiepilogo.etiQuanti.Caption = "TEST"
frmRiepilogo.Modal = True
frmRiepilogo.Visible = True

End Sub

I can just see the Riepilogo form appear and disappear in a jiffy. I put some debug.print on the form_load and form_close events of the Riepilogo form and all seems to work well (the event form_close seems to be called somewhere).
Any Hints?

Open An Access Form With A Vb App
Anyone know how to open an access database form through a visual basic application?

I dont believe I have seen this done yet.

Open A Form In Access From VB
I need to open an access form from a menu or button on a form in Visual basic. Any ideas??

Help How Can I Open A Access Form In VB
Is there anyone who can help me. I want to open some forms and reports who already made in access to open them with code from VB with a SQL statement that i also made in VB

Is this possible

How Do I Open My Access Form
Is there a way to open you're access form like you do say a word file through VB

(probably) But can anyone show me how, actually if this is possible, I want it to be the form only. I.e. the user of my program only sees the Access form, not the tables etc., they are hidden for all i care, I just want him to see the form. Is that also possible and how?

I'll probably give the user read-only rights as well


Open Form In Access
I have asked this before, however still am lost!

I have written a code to select a record from the control form when opening a report to print. The isea is that the control form data is duplicated onto the report once the control button has been selected, from this the report containing the same data as the just entered recordset of the form will be displayed.
Below is the Code:-
DoCmd.Close acForm, "NCR Report3"
DoCmd.OpenReport "Scrap Ident Docket", acViewPreview, "Scrap Docket ID select", ID = [Forms]![NCR Report3]![ID]

MsgBox "Place defective Item and NCR Docket on you're relevant quarantine area - OK to continue" _
, vbOKCancel + vbDefaultButton1 + vbInformation, "Deficiency Entered"

If Click = (1) Then
DoCmd.PrintOut acPrintAll, , , acHigh, 1, True
DoCmd.OpenForm "NCR Reporting2", acNormal, "", "", , acNormal
DoCmd.Close acForm, "Scrap Indent Docket"

DoCmd.Close acForm, "Scrap Indent Docket"
DoCmd.OpenForm "NCR Report3", acNormal, "", "", , acNormal

Can anybody help, when the report opens it is blank

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)

Option Explicit
Private Sub Form_Load()
    Skin1.ApplySkin Management.hwnd
    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)
    End If
End Sub
Private Sub Command2_Click() 'update record in database
    rs(2) = Text3.Text
End Sub

The database has only three fields, the one I want to update is field (2 = responsible) jpeg of DB seems soo simple but I'm stuck!


Edited by - vbprog1144 on 2/10/2004 6:03:37 PM

Open Form In Access Runtime
Hey all,
I am using VB(not VBA!) on a machine that has AccessRunTime. I am trying to open up a form, EditNumbers, in access from VB. I think this is possible, but I am not sure how to do it. I have tried using the "Access.Application" stuff, but I do not think that works on runtime. Any help would be much appreciated.

Open An Access Database From A Form
Hi All,
Do any of you know how to open an access database from a form?
For example, I want the access file xx.mdb to appear right before me after clicking a comand button. Can anyone give some advice??


Copyright 2005-08, All rights reserved