I have two questions concerning forms

KITT

New member
Local time
Today, 14:11
Joined
Mar 29, 2007
Messages
7
Hi!


Question 1:


I have two subforms on exactly the same place. they are even the same, but one is for reading and the other one is for inserting records.

how can I do
Data Entry = true
or
Data Entry = false
in VBA to diversify those forms? There is no field like that?

a workaround (or maybe the most common solution) seems to be: docmd.gotorecord , , acNewRec. but it doesn't work. docmd.gotorecord shall display instead of an existing record the empty form with possibility to enter values?

Question 2:

I have a subform with text boxes. let's call one of it textbox1. So, if I click textbox1, the combobox1 of the mainFrame should be updated with the value, I insert into the textBox1.

the combobox1 was created with the wizard, so it has a query itself in the raw source. Select * from qry_selectMethod Where..."

I read in many communities, that the combobox as a control source has strange behavior, and especially the requery method seems to have troubles.
Especially: PRESSING F9 after having change the text box WORKS! Isn't that strange? But the requery command in vba code doesn't.

here the textbox: Forms![frm_newEntry_newOutput]![frm_SeeMethodsForSelectedMethodType_newEntry].Form![textbox1]
here the combobox: Forms![frm_newEntry_newOutput]![combobox1]

Private Sub textbox1_AfterUpdate()
Forms![frm_newEntry_newOutput]![cmb_combobox1].Requery
End Sub

PLEASE HELP ME!


Thanks,
Alex
 
Last edited:
Ok I look at 1 first

this is quite easy
on one of your forms there is properties locked this will be no change it to yes that will lock the form down
also take off all allow edits allow deleteions allow creations set these to no
should do it

regards
 
You shouldn't need two forms for viewing and editing. You can use the same form, if everything else is the same on them. You can use code to lock it down until you want it to be edited.

The simplest method is to set the properties of the form to:

AllowEdits = No

That will allow additions/deletions but no editing after a record is initially entered. Then, have a button that has the code to:

Forms!YourMainFormNameHere.Form.YourSubformCONTAINERNameHere.AllowEdits = True

And then reverse that to false in the ON Current event of the form so it locks down as you move through records.
 
but:

AllowEdits means, I can edit the form. How do I view an empty one? I don't want to edit existing records.

If the solution is docmd.gotoRecord, , acNewRec, I am in troubles.
The button gotonextButton is on the mainframe. but the record which has to be browsed is in a subform. Which parameters does docmd.gotoRecord need? I couldn't find any solution yet.

thanks,
alex
 

Users who are viewing this thread

Back
Top Bottom