GoToRecord Procedure
May 7, 2007
I have the following code in my VB:
DoCmd.GoToRecord , [Response Tasks], acGoTo = [Response_ID], "08"
This is not working however.... The table name is Response Tasks, the Column name is Response_ID and I am trying to pull the info from the one named "08". What am I doing wrong in the procedure?
Thanks in advance
View Replies
ADVERTISEMENT
Jul 31, 2014
I have just made a change to one of the forms by adding a button (by copying the only other button on the form) to cancel any changes and close the form. However, as soon as I added it I started getting the error message in the title. Please attachment LA Err1 for the full message. I also changed the caption on the other button on the form from "Close Form" to "Save && Close Form" this button is now giving the same error.
I have Compacted and repaired the DB on several occasions to no avail. I have deleted the procedures from the module and recreated them using the properties window - still get the error. I have deleted the buttons from the form and recreated the both via the object wizard and without it. Nothing I have tried has made any effect.
View 5 Replies
View Related
May 9, 2005
I'm having trouble getting my subform to go to new record from a main form.
How would I go about making a command button(new record) on a main form link to a subform.
Example: After clicking on command button I would like my main form and subform to go to new record.
Thanks,
Michael
View 1 Replies
View Related
Sep 1, 2005
Hi All,
I have a subform in which users kan edit a field. Some contain more than 100 records. After 'an edit' the code save the adjustments in the table. Then the subform automatically jumps to the first record, but I want it to go to the previous record which they just edited. Is that possible? Here's the code so far:
Private Sub Afgehandeld_Click()
If Afgehandeld.Value = 0 Then
AfgDatum.Value = Null
DoCmd.Save
Me.Requery
Else:
DoCmd.OpenForm "formulier5"
End If
DoCmd.Save
Me.Requery
End Sub
View 1 Replies
View Related
May 25, 2006
Hi there I currently have a DB with a ton of records. What I want to do is have a search box pop up when the user presses a button on the main form. When this search box comes up there is a list box with all the records. The user will then double click a record on the List box and it should appear on the main form. However this is not happenening. Here is my code for the double click in the list box.
Private Sub List3_DblClick(Cancel As Integer)
On Error GoTo Err_List3_DblClick
' Open the info form based on the selection in this listbox.
Dim strFormName As String
strFormName = "complaints"
DoCmd.OpenForm strFormName
DoCmd.GoToRecord , strFormName, acGoTo, " caseid = " & Me![List3] (I think this is where the error is)
DoCmd.Close acForm, "frmLookup"
Exit_List3_DblClick:
Exit Sub
Err_List3_DblClick:
Someone please help!!!
thanks
MsgBox Err.description
Resume Exit_List3_DblClick
End Sub
View 1 Replies
View Related
Apr 23, 2008
Hi,
I have a subform on a tab control. How do I go to the last record of that sub form?
If I use the original form (not as a sub-form), the following code works, but when in the tab control I get an error that "blah blah Form is not open"
Any suggestions? Thanks
Code:DoCmd.GoToRecord acDataForm, "Stock Transfer", acLast'works when main form, but not as subform =/
View 8 Replies
View Related
Oct 27, 2005
Hi there
I am making a form that has been set up to have a number of tabs so I can have more then 1 page on the form.
One of the tab pages is used as a search form.There is a couple of textboxes and a listbox where the results end up
What I am trying to do is have a double click set up on the listbox so I can double click the result I want and have the forms ID goto that record.
Its a bound form. The primary key is called PersonalID and its bound to a txtbox called txtPersonalID.
this is my code but its not working
Private Sub lstSearchResults_DblClick(Cancel As Integer)
Dim strPersonalID As String
strPersonalID = Me.lstSearchResults.Column(0)
DoCmd.GoToRecord acActiveDataObject, "PersonalID", acGoTo, strPersonalID
DoCmd.GoToControl "pgePersonalInformation"
End Sub
When I try run the code I get an error 2489. saying The object 'PersonalID' isn't open.
What am I doing wrong?
Can anyone help out
TIA
View 2 Replies
View Related
Aug 15, 2006
i have a listbox that manipulates records on another form but in case i click on one of the records in the listbox that doesnt have any corresponding record in the other form then instead of it saying that it cant locate the record i would like the form to go to a new record....
i've been trying at it but cant get it right...
plz assist... anyone.
View 14 Replies
View Related
Dec 28, 2014
On a Single Form with a sub-form I have set up the typical navigation buttons using the DoCmd.GoToRecord, ,acx where x = Next, Previous.
These navigate through the sub form records. I only want to navigate through the master records.
Extensive searching did not turn up the answer. There are many articles on moving through the sub-fom but nothing about just the master.
View 4 Replies
View Related
Aug 30, 2007
hi
could you please tell me what action will be happned when this both statement executed..
DoCmd.GoToRecord , , A_NEWREC
SendKeys "%N", True
Form ahse defines these statement as well.
Option Compare Database
Option Explicit
View 2 Replies
View Related
Jul 20, 2005
I have searched the forum for questions similar to mine, but they all seem more complicated than what I need... and so I am getting a little confused with it all!
I would like to create a "GoToRecord" field in which people can enter a name which then take them to that record (stored in my "ClientName" field) on the Main form...
Can anyone help?
Tx!!
frederique.
View 2 Replies
View Related
Jul 21, 2006
Hi guys. i guess i am half way through. just like final step left still trying to figure it out how to create a VB procedure. anyways this is my theory and this is how much i have achieved. my God i have searched i guess every forum trying to get an answer it should'nt be that hard. I have a database. what i am trying to do is that i have a button for view reports which prompts the user to another form with 3 buttons
1) Issue(based on my query)
2) Issue Resolved(based on my query)
3) Issue not resolved(based on my query)
i am using this onclick command
Private Sub Issue_Resolved_Click()
DoCmd.OutputTo acReport, "Issue resolved", acFormatXLS
End Sub
same thing for my other options. works fine but when i open the report in Excel the whole formatting is bad so with my research i found this code very valuable. a standard module code which is as folllow.
' // Generically formats a worksheet
Private Sub GenericXLFormat(ByRef xlApp As Object, ByVal strDescription As String)
On Error Resume Next
With xlApp
.Rows("1:1").Font.Bold = True
.Cells.EntireColumn.AutoFit
With xlApp.ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
.PrintArea = ""
.LeftHeader = ""
.CenterHeader = strDescription
.RightHeader = ""
.LeftFooter = "&""Arial""&8WF COF/SIP Database " & APP_VERSION
.CenterFooter = ""
.RightFooter = "&""Arial,Bold""&8CONFIDENTIAL"
.LeftMargin = Excel.Application.InchesToPoints(0.5)
.RightMargin = Excel.Application.InchesToPoints(0.5)
.TopMargin = Excel.Application.InchesToPoints(0.8)
.BottomMargin = Excel.Application.InchesToPoints(0.75)
.HeaderMargin = Excel.Application.InchesToPoints(0.5)
.FooterMargin = Excel.Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End With
End Sub
i tried to debug it and compile it no errors. now this is what i want and i will be done. what i want is when a user clicks on my report button which is (Issue) i want this Xlformat module to be run with my onclick button. i can't find or cannot think of any procedure since my skills in VB is not that very good. all i wanted to do is create some kind of procedure with this Xlformat module so then a user will be able to save the report as an excel file and then when he opens it the report in excel should be in perfect format. columns, width should be alligned automatically. i have been searching days and night with different answers to create a template or do this and that but nothing works plz help guys. i really appreciate it.
Thanks
View 2 Replies
View Related
Apr 11, 2006
Can someone help? I am working on an event database (based on Microsoft 2003 event database template). At present when I register attendees, I can preview an invoice which is generated based on the information I have entered.
I have set up another option to preview a Letter of Confirmation based on this same principal. As I am "Visually Basic" challenged, I simply 'copied & pasted' the event procedure and made the changes as needed to ensure the correct report was opened (ie not the Invoice report but Confirmation Letter report).
However, when I click the button to open preview the letter, the "Print Invoice" box also opens up (as it does when previewing the invoice). I don't want this box to open as I don't need to enter any details.
Can someone please have a look at my VBA event below to see what I would need to delete to stop the "Print Invoice" box from popping up.
Private Sub LOC_Click()
On Error GoTo Err_ConfirmationLetter_Click
If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter attendee and registration information before previewing the Confirmation Letter."
Else
DoCmd.OpenReport "ConfirmationLetter", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID]
End If
Exit_ConfirmationLetter_Click:
Exit Sub
Err_ConfirmationLetter_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_ConfirmationLetter_Click
End Sub
Many thanks for any help.
Kath Price
Auckland, New Zealand
PS - Below is the original 'Preview Invoice' event that I copied:
Private Sub PreviewInvoice_Click()
On Error GoTo Err_PreviewInvoice_Click
If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter attendee and registration information before previewing the invoice."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "Invoice", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID]
End If
Exit_PreviewInvoice_Click:
Exit Sub
Err_PreviewInvoice_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_PreviewInvoice_Click
End Sub
View 2 Replies
View Related
Oct 18, 2005
In my database I track a program called Bridge. Once you open bridge you can have anywhere from 1 to 7 "Sessions". Each bridge is assigned a number IE LT175A. If there are mulitple sessions they are numbered LT175A, LT175B, LT175C etc. I have a check box in my database that shows if bridge is installed on that PC. If it is then my section for session numbers are visiable, if bridge is not checked then the session numbers section isn't visiable. I currently have my Event Procedure in the After Update section. My code works because if I unclick on bridge my sessions disappears. However when I go to the next record if bridge is checked then my sessions are visiable but on the next record where it isn't checked it still displays the session section. So it isn't adjusting itself from record to record. Does my code need to go someplace else or am I doing something else wrong?
Here is the code I have:(and it's under After Update)
Private Sub Bridge_AfterUpdate()
If Me.Bridge = False Then
Me.BridgeSession_1.Visible = False
Me.BridgeSession_2.Visible = False
Me.BridgeSession_3.Visible = False
Me.BridgeSession_4.Visible = False
Me.BridgeSession_5.Visible = False
Me.BridgeSession_6.Visible = False
Me.BridgeSession_7.Visible = False
ElseIf Me.Bridge = True Then
Me.BridgeSession_1.Visible = True
Me.BridgeSession_2.Visible = True
Me.BridgeSession_3.Visible = True
'Me.BridgeSession_4.Visible = True
'Me.BridgeSession_5.Visible = True
'Me.BridgeSession_6.Visible = True
'Me.BridgeSession_7.Visible = True
End If
End Sub
Thanks,
Rick
View 2 Replies
View Related
Jun 12, 2007
Hi,
I need to write a stored procedure that sits between sql server and MS access. This procedure will make sure that the queries run in access against the data in sql server will not access data for more than two years back. This is so that the queries run against the sql server do not hang up the server for too long.
Thank you.
View 2 Replies
View Related
Oct 20, 2006
In one of my forms, i have this event procedure:
Private Sub Gross_Com_LostFocus()
If Gross_Com.Value >= 1000 Then
Full_Com.Value = [Gross_Com] * 0.2
Else
Full_Com.Value = 0
End If
End Sub
Is it possible to put such code in a report and query? If so, how?
Thanks a million!
Cheers!
Sheila
View 2 Replies
View Related
Jun 27, 2005
I have a procedure which can put in a Restocking Charge, it works good but you have to type it in each time here it is:
Dim strInput As String
Dim strMsg As String
strMsg = "Enter Restocking Charge?" & vbCrLf & vbLf & _
"Enter percentage."
Select Case MsgBox("Is There a Restocking Charge?", vbYesNo Or vbExclamation Or vbDefaultButton1, Application.Name)
Case vbYes
Beep
strInput = InputBox(Prompt:=strMsg, Title:="Value")
Me.RestockingChg.Value = strInput
Case vbNo
Me.RestockingChg.Value = ""
End Select
I tried using the txtbox DefaultValue property and setting.DefaultValue and niether work very well. Is there a way to set the pop-up to display 15 or 15% when it opens and then be able to type over it? I can do that with a form, but the form open all ever the place and I couldn't get it to hit enter with out tabing or clicking the cmdButton. Thank you in advance to anyone helping out on this little bug. :eek:
View 2 Replies
View Related
Nov 28, 2006
Greeting wise one...
I have implemented a logon script found in this forum - many thanks.
In essance, the script opens a form with info based on a table.
Could I filter the records of the form by only only including those records that are associated with the UserID of the user that just logged on?
The script:
Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this
'matches value chosen in combo box
If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", _
"[lngEmpID]=" & Me.cboEmployee.Value) Then
lngEmpID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmMain"
Perhapt a filter here?????
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
View 7 Replies
View Related
Nov 30, 2006
I know this has got to be a simple reference problem, but I just can't figure it out. I am trying to pass a nested subform to a procedure, but I keep getting a type mismatch error. Here's an example:
Call MyProcedure(Forms!MainForm.Form!Subform1.Form!Subf orm2)
Public Sub MyProcedure(frm as Form)
.
.
End Sub
View 3 Replies
View Related
Feb 10, 2005
Hopefully I can explain this right, I have a text box (text7) that is bound to my table. This text box stores a 2 didgit code between 10 and 99 to the main table. I want to be able to use a random function =Int((99-10+1)*Rnd+10) and have the generated number output to text7 only after I initiate the onclick command for the button the function is behind. Does this require a macro to output the number to the bound textbox or is there another way that someone knows of to do this?
Thanks All, Narack
View 1 Replies
View Related
Apr 1, 2005
How do i create a Function procedure that calls the Sub procedure from vis Basic? ?
View 1 Replies
View Related
Dec 19, 2007
Hi, I have a procedure in a form that I need to run on the first day of each month at 5:00 am. Is there a way or VBA codes that can get this procedure to be run automatically at that time? Thanks for any help!!!
View 14 Replies
View Related
Apr 17, 2006
Can you step into an Event Procedure line by line in Access? I toggled the Breakpoint at the End Sub of the Event Procedure, clicked in the middle of the sub, and pressed F8. Nothing! I do this all the time in Excel.
View 2 Replies
View Related
Aug 30, 2006
Hi,
Is it possible to call a procedure that exists in one form on another form please?
Regards,
B
View 13 Replies
View Related
Oct 14, 2005
why aint this working ?
Expr1: Mid([MinuteCode];1;InStr(1;[MinuteCode];".")-1)
View 14 Replies
View Related
Jan 23, 2005
Try this one guys,
I have a form based on a Query with Comboboxes reading a Table.
the Combo's populate Textboxes with code as:
Private Sub Combobox1_AfterUpdate()
Me.Textbox1=Combobox1.Column(1)
End Sub
Combo bound to column 1,Row source=table.
This was created in Access 2000 and works fine, but when tried in '97 Textboxes are not populating.
I cannot figure out what is wrong.
(Need it in '97 for work purposes)
View 7 Replies
View Related