Search results

  1. D

    text box order

    Two options here... Either sort your Recordsource by that field or in the Open event of the form put the following code.. me.orderby = "[TextFieldName]" me.orderbyon = true Hope one of these helps for you. Doug
  2. D

    keeping form open

    Put this function in a module.... Function fIsLoaded(ByVal strFormName As String) As Integer 'Returns a 0 if form is not open or a -1 if Open If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then If Forms(strFormName).CurrentView <> 0 Then fIsLoaded = True...
  3. D

    Help with form controls

    Just put these two functions on your form in the AfterUpdate event of the combo box and the Click of the checkbox. Private Sub chkBox_Click() If Me!chkBox = False Then Me!cmbBox = Null End If End Sub Private Sub cmbBox_AfterUpdate() Me!chkBox = True End Sub Where chkBox is...
  4. D

    combo box lookup/autopopulate/subform involved

    Sorry it took so long to get back to you... What is cinfo? I'm assuming your form? First off, I don't see you opening the form in your code. Also, if cinfo is the name of the form, then you have to put quotes around it, i.e. while fIsLoaded("cinfo"). I would assume that is your problem...
  5. D

    combo box lookup/autopopulate/subform involved

    Alright, first off, you can set the tabstop property to No if you don't want to tab to something. You could also lock all the textboxes you don't want edited... So only keep your subform items unlocked. Now, how do you have your subform and form linked? Is it by MC#?
  6. D

    combo box lookup/autopopulate/subform involved

    So what I am assuming is that your form does not allow edits? When you have an existing MC# it populates the fields and you want it to do that for a new number too, right? If your form allows edits, when you insert the new MC# in, you can just fill the data right in on the sheet. That will...
  7. D

    combo box lookup/autopopulate/subform involved

    Alright, here was my reply and now I see what was going wrong, I think... I assumed MC# was a number not text.. Private Sub Combo32_NotInList(NewData As String, Response As Integer) Dim MyDB As Database Dim MySQl As String Set MyDB = CurrentDb MySQl = "INSERT INTO [Customers] (CustMC #)...
  8. D

    emulate combo lookup?

    This will do a lookup for you and return your data in a recordset... dim MyDB as database dim MyRecs as recordset dim MySQL as string dim YourID MySQL = "SELECT [FieldName] FROM [TableName] Where [FieldCriteria]='" & txtCriteria & "'" set MyDB = currentdb set MyRecs =...
  9. D

    combo box lookup/autopopulate/subform involved

    My Reply from your previous thread suggested that you run an Insert SQL function in the NotInList event. What didn't work there?
  10. D

    Searching using own forms

    Kenneth gave a good procedure but I think you're looking for something a little more simple... If I understand your question correctly, you just want to return the ID of a user with a given First and Last name... To create unbound textboxes on your form, just simply click on the textbox icon...
  11. D

    Simple open form questions

    In order to close any object that is open you still use the docmd.close but you have to specify what you are closing... if you type in docmd.close then hit the space bar, you'll see the options pop up.. Below is an example... DoCmd.Close acForm, "FormName", acSaveNo Hope this helps. Doug
  12. D

    calling different forms from one unique form

    Well, I'm not too sure what you mean by that but if you just want to open different tables based on different responses then you should use a select case statement... Select Case me!FieldName Case "Response1": 'Use Table1 Case "Response2"; 'Use Table2 . . . End Select Hope that helps... If...
  13. D

    Refer to value from Query in VB-code

    If you're looking for a specific value based on criteria you could also use this... dim MyDB as database dim MyRecs as recordset dim MySQL as string MySQL = "SELECT [FieldName] FROM [QueryName] Where [FieldCriteria]='" & txtCriteria & "'" set MyDB = currentdb set MyRecs =...
  14. D

    Listbox number format

    You should set the format to display four decimal places in the SQL statemnt in your rowsource. Go to the SQL builder in the row source field of the properties sheet. In the field that you're looking for the decimals put this as the field Name.. NewNumber: format([OldNumber],"#.0000")...
  15. D

    Strange behavior of combo box

    What about just refreshing the form instead of saving the record... Use me.Refresh Doug
  16. D

    close button causes on exit events

    Yeah, I'm sorry, I didn't realize what you were trying to do. The code I gave you won't fire unless if you update the field. So if you pop into it and right out, the event will never fire. You could always try putting the code in the BeforeUpdate event of the form. And just use an if...
  17. D

    expression

    It is most likely in the formatting of your dates. Check the regional settings in your Control Panel and see what format your date is in. It is really tough to use the Mid function with dates unless you use it on a formatted date, i.e. mid(format(Date,"mm/dd/yyyy"),4,2). Without the...
  18. D

    using + and - to change date

    Sure.. First, you have to lock the textbox by setting the Locked Property to Yes. Then all you have to do is put the following code in the KeyDown event of the text box... If KeyCode = vbKeyAdd Then Me!TxtDate = DateAdd("d", 1, Me!TxtDate) ElseIf KeyCode = vbKeySubtract Then...
  19. D

    find record according to date

    Yes you can use it for a subform... Just set the filter of the subform to the date criteria or set the recordsource to some SQL statement. Filter: Me!SubForm_Name.Form.Filter = "[DateField]>=#" & me("txtBeginDate") & "# AND [DateField]<=#" & me("txtEndDate") & "#"...
  20. D

    Hiding Combo box on form

    Just a thought but why not make it visible on the push of the command button? If you have two buttons to open the form, one to search, and one to add records then make set the combobox's visible property to false. Then in the add records command button Click event, right after you open the...
Back
Top Bottom