Topics Search

How to make cmd buttons (undo & clear) work on subforms

How to make cmd buttons (undo & clear) work on subforms
Views: 63
On the Main form I have cmd buttons that clear and undo.

Specifically the Undo doesn't undo the subforms, just the Main form. I also am not sure how to make my clear button, clear out all controls on all 3 forms.
Sponsored Links:

Similar posts...


Buttons doesn't work in Subforms

Buttons doesn't work in Subforms Icon
I'm kinda newbie in access. I got sort of a dumb question ('cause I know I'm doing something wrong I just don't know what. I looked for answers but couldn't find any.)

it goes like this :
I have 2 reports and one form for example
on the 2 reports I have a command buttons that opens another form that contains the record values

when I view the report separately the button work.
when I put it in the main form as a sub forms the buttons suddenly pops up a parameter missing alert box ( I mean the one you can fill the value and hit ok)

the event of the buttons is onClick macro
open form
where [reports]![name of report][name of field]=so on.

hope I'm clear on my questions and that for you guys it's a kinder garden question!

sorry about the english . it's not my native!
hope to hear good news

Link Tables with A Master table & Two Other unconnected tables

Link Tables with A Master table & Two Other unconnected tables Icon
Title to this question probably not very clear, I should know this but for some reason I can't work it out. It is either obvious or not possible at all in a simple query.

I have a table "Master" & tables "A" & "B"
A & B are actually the main tables with thousands of records.

Master is a selection of either A or B on Todays Date, 20 or so records.

Master has a Link ID to A
Master has a Link ID to B

A & B are not related

Is there a way to set up a single query that shows all the records
where Master has a matching A & Master has a matching B

If I link Master to both tables ID of course there is no match throughout all the tables.

Don't want them on seperate subforms

I don't think I have made that very clear but hopefully get the gist

Delete Record

Delete Record Icon
When I run this code, it works fine, but I get a value of "#Deleted" in the controls. What am I doing wrong?

If MsgBox("Are you sure you would like to delete History" & _ " from this record only", vbQuestion + vbYesNo,= vbYes Then
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = "DELETE FROM tblPre WHERE Number = '" & Me.[Ratio Number] & "'"
Me.Refresh Else End If


gotorecord Icon
I understand that 'DoCmd.GoToRecord , , acNewRec' works fine in
clearing the records in a form and presenting a fresh form for data entry for the user. I have a form which contains a few subforms. After data is
entered I need to clear the fields for new data entry, so I tried the
above code and it dosent seem to work. Is it because I am trying to clear
the records of the subform from the main form? Is there a way around
this? I really need to have the form holding all the subforms.

Access 2007 Saving File

Access 2007 Saving File Icon
Wondering if anyone has same problem as I do and if there is a fix or trick? Access 2007 Esc and Undo together are nice to recover accidentally deleted data. My problem is that while I'm typing and accidentally delete data somehow that the Esc and Undo work against me by recovering back to some previous point in my work and not allowing me to recover what Access thinks ishelping.

To me Microsoft has it backwards. I have to Save the File, then make a change, then undo it, then save it again. before the Esc and Undo cannot lose my work for me. They should haveREVERSED this process and made recovery take 4-5 steps not saving (which I do when entering technical & difficult data about every 60 seconds.
The other problem is every time I save data (large text fields) the cursor goes to the top of the field and I find only Top or Bottom choices available. The amount of time I spend saving(for sure) and getting back to where I was takes nearly as long as the data I enter between each save : ( is anyone else having this problem?

So what I'm asking is a way to save the Access file without Esc or Undo messing it up, and how to get the cursor back where it was at the time of the save. I'm guessing a macro may do itbut I'm not familiar with the vb code stuff people talk about.

Setting the Focus to a Navigation Sub Form

Setting the Focus to a Navigation Sub Form Icon
seems ages since I was last on here but am back to finishing off my DB and need some advice again !

I have a Access Navigation form, with subforms within each 'button' one of these buttons is called 'Treatment Menu' (NavigationButton19)

On the 'Treatment Menu' subform (called 'NavigationSubform' by default) I have some cmd buttons to open the relevant user forms. when any of the buttons are clicked the relevent user form opens and the Navigation form closes.

On the current open user form I have put in a cmd button called 'Return' - which is where the problem is.

Is there a way I can return to the Navigation form to the same point that I came from - in this case the 'Treatment Menu' subform?

I have tried using Docmd and Forms! ect ect but nothing seems to be working

Enable Button based on Date box Values

Enable Button based on Date box Values Icon
I am getting confused trying to code a button after dates have been entered in two boxes - Start Date and End Date

On opening the form the cmd button (View Reports) is disabled. The user enters dates in the Start and End date boxes, once this is done the cmd button enables.

However if they decide to clear the dates (using another cmd button 'clear Dates') then I need the View Reports button to go back to being disabled.

I have tried the following on lost focus, on change ect but noting seems to work!

'Enables Cmd View Report if dates have been entered
If Me.txtDateStart.Value = "" And Me.txtDateEnd.Value = "" Then
Me.cmdViewReport.Enabled = False
Me.cmdViewReport.Enabled = True

Assign a command to a variable and then run the variable?

Assign a command to a variable and then run the variable? Icon
I have a form that has two textboxes, txtStartDate & txtEndDate, that are used as criteria for a query. Also on the form are two buttons, btnRefresh & btnPrintReport. Both buttons need do to the same checking to make sure that the textboxes have dates in them.

I would like to make that check be done in a function. The problem is that what needs done in the If False portion is different for the two buttons.

btnRefresh will requery a subform and btnPrintReport will open a report.

Using module to modify form

Using module to modify form Icon
I've managed to create a form that accepts usernames and passwords and once a user enters a correct username/password the form closes and opens the mainpage of the database (simply has many cmd buttons to allow users to open reports, view/update data etc.). Each user has a different level of access (there are a total of 3 levels of access). Instead of creating a form for each level of access that has the appropriate buttons I'm hoping to use one form and simply use some form of VBA to enable/disable the buttons. I'm thinking this would be best done in a module, however, I'm not sure of how to set text box/cmd button properties from inside a module. if this is even possiable.

Should I attempt to use only one form w/ VBA to enable/disable all the buttons depending on access level or just stick w/ my current plan and make 3 seperate forms, one for each level

VBA Script to run select query

VBA Script to run select query Icon
Dim cmd As ADODB.Command
Dim strQueryText As String

cmd.ActiveConnection = CurrentProject.Connection

cmd.CommandType = adCmdText
strQueryText = "SELECT Store_Profile.SPStoreNo, Store_Profile.SPSiteNo, Contact_Profile.CPExtAcctPhoneNo, Contact_Profile.CPExtAcctFaxNo"
strQueryText = strQueryText & "FROM Contact_Profile INNER JOIN Store_Profile ON Contact_Profile.SPStoreNo=Store_Profile.SPStoreNo" & ";"
cmd.CommandText = strQueryText